fixing logout functionality