Properly handle foreign streams
Merge pull request #197 from binlain/master

Fix crash in node and properly pipe streams.