reverted getSegmentByIndex() to getSegment()