added if-statement in onResume()-method