fixes a variable leaking to global scope