Bug fix - need to pass generator to serialize_trees.