Fix bugs in MaxRazorTemplateEngine