add debug prints to segment creation