Corrections to handle multiple batches correctly