fixed global variable untested