JNI: Fix some wrong uses of the `genv' global variable.
JNI: Set `genv' before msig_set_instance_data() since it triggers a callback.