fix jni memory error