fix bug in cordova plugin