Only check cordova when needed for performance

Fixes issue #9