Error: variable 'KEY' not defined