Fix variable name and simplify template rendering.