added error handling for bad login