implement batch function. fix some delete mismatch.