enhance onResume  and onPause