fixed blatant argument-conversion bug in JavaScript API