score_trees(): fix iteration over trees with missing entries