fix bugs & add jni interface