name 'key' is not defined