Fix use of a global variable