Various batch processing bug fixes. More tests for batches.