Code review fixes for SIGPIPE