Fix crashing due to onResume