fixes segment number calculations for SegmentTemplate and SegmentList