fixed login/logout bug