fixed Logout function