Fixed a bug with error messages causing a fatal error