Fix segment-deletion bug