Fix bug in var tracking