fix an error when emitting errors
3.0.1