Java port update and several fixes