Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 10704)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/GeorefImage.java	(revision 10705)
@@ -66,5 +66,8 @@
 		out.writeObject(max);
 		out.writeObject(min);
-		ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
+		if(image == null)
+			out.writeObject(null);
+		else
+			ImageIO.write(image, "png", ImageIO.createImageOutputStream(out));
 	}
 }
Index: applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java
===================================================================
--- applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 10704)
+++ applications/editors/josm/plugins/wmsplugin/src/wmsplugin/WMSLayer.java	(revision 10705)
@@ -61,5 +61,5 @@
 
 	protected String baseURL;
-	protected final int serializeFormatVersion = 3;
+	protected final int serializeFormatVersion = 4;
 	
 	private ExecutorService executor;
@@ -143,7 +143,6 @@
 		if( !startstop.isSelected() || (pixelPerDegree / (mv.getWidth() / (b.max.lon() - b.min.lon())) > minZoom) ){ //don't download when it's too outzoomed
 			for(int x = 0; x<dax; ++x)
-				for(int y = 0; y<day; ++y){
-						images[modulo(x,dax)][modulo(y,day)].paint(g, mv);
-				}
+				for(int y = 0; y<day; ++y)
+					images[modulo(x,dax)][modulo(y,day)].paint(g, mv);
 		} else {
 			for(int x = bminx; x<bmaxx; ++x)
@@ -164,5 +163,5 @@
 		for(int x = 0; x<dax; ++x)
 			for(int y = 0; y<day; ++y)
-				if(images[x][y]!=null){
+				if(images[x][y].image!=null){
 					v.visit(images[x][y].min);
 					v.visit(images[x][y].max);
@@ -192,9 +191,7 @@
 		for(int x = 0; x<dax; ++x)
 			for(int y = 0; y<day; ++y)
-					if(images[x][y]!=null && images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null){
-						if (images[x][y].contains(eastNorth)) {
+					if(images[x][y].image!=null && images[x][y].min!=null && images[x][y].max!=null)
+						if(images[x][y].contains(eastNorth))
 							return images[x][y];
-						}
-					}
 		return null;
 	}
@@ -227,4 +224,5 @@
 				oos.writeInt(ImageSize);
 				oos.writeDouble(pixelPerDegree);
+				oos.writeObject(name);
 				oos.writeObject(baseURL);
 				oos.writeObject(images);
@@ -257,14 +255,15 @@
 					return;
 				}
+				startstop.setSelected(false);
 				dax = ois.readInt();
 				day = ois.readInt();
 				ImageSize = ois.readInt();
 				pixelPerDegree = ois.readDouble();
+				name = (String) ois.readObject();
 				baseURL = (String) ois.readObject();
 				images = (GeorefImage[][])ois.readObject();
-
 				ois.close();
 				fis.close();
-				startstop.setSelected(false);
+				mv.repaint();
 			}
 			catch (Exception ex) {
