fixed global leak of variable key