fix api key retrieval from cache