Modified for newer cordova version.