Nils patch for retrying partial fetches, with minor changes by me.

Fixes #1638
Fixes #1641