more fixes for reading from pipes [#2162]