class: fix thread issues when using a class between thread (j_cls MUST be a global ref to work.)