Use template variable from the correct scope