Fix the "broken pipe" bug

No tested yes, but I assume that this was the problem.