fixed error handling for failed login