added a error if user input is invalid.