handle intermittent network errors by sleeping and retry