batch being set to true in a loop