Fixed issue that caused the onBackPressed function to recursively call itself until into stack overflow