Fixed index_of bug