Fix fallout from batching rework

These commits fix some of the many regressions from the large round of changes to the batching logic.

While the PR is against master, all of these patches apply -- and are necessary I believe -- for v44 as well.

Note that, while with these patches it's possible to do *some* things again, there are still several major regressions to address before it's back to a working state. However, I'll be turning my attention to v44 now -- so some of the remaining regressions in master might not be relevant to me anymore; and any fixes I might do from now on will not necessarily apply to master...