Fixed insert index bug