Some cleanup for JNI scope