fixes a bug where multiple active sockets could write on data events