Fixing regression bugs caused by the event emitter refactoring