Fix bug when insertion end was duplicated