Minor fixes for the Java API (no functional changes)