fixed validation of api key