Modified implementation of error message output.