corrected error handling for login