Fix fallout from batching rework

These are the same fixes as in #74, but rebased and resubmitted for the v44 branch.

(In the hope that they have a better chance of getting merged that way...)