Fixed some bugs with java bindings