fix a bug when batch size changed