Improved handling of TemplateRefs solve problem with dynamic loading of
referenced templates