Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java	(revision 24954)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/GeorefImage.java	(revision 24955)
@@ -46,5 +46,5 @@
     public GeorefImage(BufferedImage img, EastNorth min, EastNorth max) {
         image = img;
-
+ 
         this.min = min;
         this.max = max;
@@ -141,7 +141,7 @@
             }
         }
-        g.drawImage(image, minPt.x, maxPt.y, maxPt.x, minPt.y, // dest
-                0, 0, image.getWidth(), image.getHeight(), // src
-                null);
+            g.drawImage(image, minPt.x, maxPt.y, maxPt.x, minPt.y, // dest
+                        0, 0, image.getWidth(), image.getHeight(), // src
+                        null);
         if (backgroundTransparent && transparency < 1.0f)
             g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
@@ -237,6 +237,9 @@
         out.writeDouble(orgCroppedRaster[2].getX()); out.writeDouble(orgCroppedRaster[2].getY());
         out.writeDouble(orgCroppedRaster[3].getX()); out.writeDouble(orgCroppedRaster[3].getY());
-        out.writeInt(imageOriginalHeight);
-        out.writeInt(imageOriginalWidth);
+        // Write image as a format 3 if cache was loaded with this format to avoid incompatibilities.
+        if (WMSLayer.currentFormat >= 4) {
+            out.writeInt(imageOriginalHeight);
+            out.writeInt(imageOriginalWidth);
+        }
         ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
     }
Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 24954)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/WMSLayer.java	(revision 24955)
@@ -231,7 +231,7 @@
             paintCrosspieces(g, mv);
         }
-        if (grabThread.getImagesToGrabSize() > 0) {
+        //        if (grabThread.getImagesToGrabSize() > 0) {
             grabThread.paintBoxesToGrab(g, mv);
-        }
+            //        }
         if (this.adjustModeEnabled) {
             WMSAdjustAction.paintAdjustFrames(g, mv);
@@ -379,4 +379,6 @@
      */
     public void write(ObjectOutputStream oos) throws IOException {
+        // Set currentFormat to the serializeFormatVersion
+        currentFormat = this.serializeFormatVersion;
         oos.writeInt(this.serializeFormatVersion);
         oos.writeObject(this.location);    // String
