[BUG #7203] Fixed wrong index calculation.