modified behaviour of the back button so that the app doesn't close unless in main