-fixed a small bug in the tree rooting algorithm