fix socket bug which didn't block SIGPIPE properly