fix login and logut mechanism, #2