Fixed a crash bug with onResume