Changed error to use a global variable.