fixes a bug with multiple active sockets writing on data events