fix null-pointer bug in CreateBatch