Correctly memoize segments