Fixes a global leak

The `key` variable leaks in the global namespace