Fixed exit button functionality