Updated variable setting logic for previous version

Updated variable setting logic for previous version