adding handler restore for sigpipe