Fix login/logout loop