fix bugs in sign in function