fixed login/logout process