Fix reference allocation in variable