Protect against odd undefined property errors

...which should never happen in the api object, but
for some reason is happening.
Merge pull request #122 from roykolak/undefined-api-properties

Protect against odd undefined property errors