added retry logic for broken pipe problem