Override onPause / onResume and fix crash.