correct error checking to replace variables

the UI message when a variable exists slightly changed