Update onPause function.