Moving line 99 to above the loop.
Adding the missing traverse_tree function call to pre-order traversal.