updated error handling for login