I don't thing `node_pos` should be used here, as it is the last value for that variable after the previous loop.
Should it be `op_pos[var]`?