Fix bug in event emitter class.