segments.get_segments: fixed set index bug