Small fixes to Java code