update function preRootTraverse