changed onBackPressed function