Fix compatibility with cordova 3