multiple fixes to sign in function