Fix undefined EventEmitter

Define EventEmitter before assigning it.