Fixed some bugs with the login process