api var not initialized, prior to testing valid key