fix login/out bug