emit errors properly