Fixed error on login, where massive amounts of exceptions

were being thrown
Fixed syntax error in sql statement