add support for segmented stacks