Fixed crash when returning from sleep mode.