fix pipe and tcp streams