Fix for cordova 3 and fix compile bug