Fixed proper logout functionality