Fixed bug with error messages