resolve the async problem by using EventEmitter