Improved creation of error message