fixed bugs in the auth