correcting variable access in template