added handling for failed login