Fix deprecated variable access in template