fixed template_from_string when the template includes or extends other ones