Issues in management of local reference to jni objects fixed.