Changed replace_var so it mutates the original program in memory as opposed to returning a copy, which would break the tree of symbol tables