fix bug related to batch management