fixed PipeWriter to accept pipe reference