Fix some bugs related to converting c++ to java.