Don't overwrite global `key` variable

Added missing var declaration.