Corrected logout functionality