fix EPIPE handling