fix login redirecting bug