Fixed crash when running on the emulator.