Fixed some glaring bugs in the JNI bindings