Check for error messages before looping through them; no notices :-)