fixed onPause and onResume