Fixed insert_index and it's tests.