Fix bug while updating vars