Change load order of API variables and local variables in TemplateFile class so that API variables may be overwritten. This is to correct in issue pointed out within Hanna Code, but the issue was in TemplateFile rather than Hanna Code.