add support for utf8 type names; fix substitution in template