Fixing issues that occurred when moving to JavaWriter.