fix emitting write event  #16