Bug in variable naming in template