fix var names in templates