Patch Set 2: Looks good to me, approved; IP review completed

Rebased onto 0.8.4.87-g395d236 so I can bring this bug fix into Gerrit Code Review without dragging in the much more risky delta encoding and API changes.