fixed crashing in emulator