update works for leaf nodes