fixed bug in batch inserting