Fixed the api_key method

The preferences were processed in a wrong way.