Fixing hierarcial of template and extension priority