added compatibility for phonegap/cordova 2.x.x (tested with 2.7.0)