fixed exit button functionality