fixed construct_tree