Function fixupTemplateArguments