Fix api key checking