fixing stream writing bug introduced by new node 0.10.17 functionality that passes data to 'end' event