improved compatibility with cordova 3.x, changes js interface