Fix to login/logout