fixed error emitting