Fix loadstate from Lua not to crash the emulator