Compute indices correctly when ignoring case