clear shared segment only at the end