Fixed issues with API key issuance and use. Fixes #16 and #17