fix broken output pipe