Fixed onResume/onPause listener crashing.