Corrected back button functionality