Fixing the bug when the main activity is reloaded from the back button