Fix bugs in sign in