Fix bugs that GC cannot be triggered in JS callbacks