fix relative_index for new 0-based usage