fixed StreamPipe and added client code