Fix app crashing on resume