Fixing Login/Logout bug