Fix the ids before saving the input table