Add fix and tests for eventsemitter