root.getAttributes().remove(FacetHandler.KEY);
}
facetComponent = root.getFacets().get(UIViewRoot.METADATA_FACET_NAME);
if (facetComponent != null && !(facetComponent instanceof UIPanel)) {
Application app = ctx.getFacesContext().getApplication();
UIComponent panelGroup = app.createComponent(UIPanel.COMPONENT_TYPE);
panelGroup.getChildren().add(facetComponent);
root.getFacets().put(UIViewRoot.METADATA_FACET_NAME, panelGroup);
facetComponent = panelGroup;
facetComponent.setId(UIViewRoot.METADATA_FACET_NAME);
}