fixed onPause issue