Fix variable issues in the template