Improve handling error message emulation