Partially resolved some issues with JNI.