Logic for back button was fixed