Fix bugs in setting user session while logging in
Fix redirection loop while logging in