Fix for including cordova.js, some perf optimization