Fixed event emitter by moving events object into attributes