Correcting syntax of variables in template