Better error handling.
Fixed error in handling bad logins.