added error handler for cordova undefined