Adjustment to Jni, and Bug fix