Fixing some of the login logic