Fixing some errors during adaptation to java