Fix overlapping $idx