Replace undefined variable with the correct variable.