fixed logout functionality