fix segment creation