changed setVar function