fix templateselector problem by adding a template registry