Fixes to login and redirection