fixed bugs in login process