Fixed minor bugs in authentication workflow