Fixed bugs in tt#index and elves#select_index