Correct $index reference