Issue #4294: Fix bugs in JSB