corrected _find_head_of_tree