fixed crash when enter background.