Fixed bug with event emitters