Fixing the back button for popups