fix several JSDuck bugs