In the following example `sink` should wait for all piped streams to `unpipe()` before calling `_flush`. As it currently stands the following code outputs: ``` bash $ node test1.js a done ``` If you remove the `// applyFix();` comment you get: ``` bash $ node test1.js a b done ``` ``` javascript var through = require('through2'); var tap1 = through.obj(); var tap2 = through.obj(); var sink = through.obj(transform, flush); var pipes = 0; // applyFix(); tap1.pipe(sink); tap2.pipe(sink); tap1.write('a'); tap1.end(); setTimeout(function(){ tap2.write('b'); tap2.end(); }, 100); function applyFix(){ sink.on( 'pipe', function(){ pipes++; }); sink.end = function(){ if( !--pipes ){ sink._flush(); } }; } function flush(){ console.log( 'done' ); } function transform( item, e, next ){ console.log( item ); this.push(item); next(); } ``` ref: https://github.com/iojs/io.js/issues/89