Added a check for an error