update segment tree