Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java	(revision 21478)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java	(revision 21493)
@@ -175,5 +175,13 @@
                     // commune unknown, prompt the list of communes from
                     // server and try with codeCommune
-                    wmsLayer.setCodeCommune(selectCommuneDialog());
+                    String selected = selectMunicipalityDialog(wmsLayer);
+                    if (selected != null) {
+                        String newCodeCommune = selected.substring(1, selected.indexOf(">")-2);
+                        String newLocation = selected.substring(selected.indexOf(">")+1, selected.lastIndexOf(" - "));
+                        wmsLayer.setCodeCommune(newCodeCommune);
+                        wmsLayer.setLocation(newLocation);
+                        Main.pref.put("cadastrewms.codeCommune", newCodeCommune);
+                        Main.pref.put("cadastrewms.location", newLocation);
+                    }
                     checkLayerDuplicates(wmsLayer);
                     interfaceRef = postForm(wmsLayer, wmsLayer.getCodeCommune());
@@ -381,5 +389,5 @@
     }
     
-    private String selectCommuneDialog() {
+    private String selectMunicipalityDialog(WMSLayer wmsLayer) {
         JPanel p = new JPanel(new GridBagLayout());
         String[] communeList = new String[listOfCommunes.size() + 1];
@@ -401,6 +409,5 @@
         if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue()))
             return null;
-        String result = listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
-        return result.substring(1, result.indexOf(">")-2);
+        return listOfCommunes.elementAt(inputCommuneList.getSelectedIndex()-1);
     }
 
Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java	(revision 21478)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/DownloadWMSPlanImage.java	(revision 21493)
@@ -20,5 +20,5 @@
     private WMSLayer wmsLayer;
     private Bounds bounds;
-    private boolean dontGeoreference = false;
+    private static boolean dontGeoreference = false;
     private static String errorMessage;
     
@@ -107,4 +107,5 @@
         MapView mv = Main.map.mapView;
         Bounds bounds = new Bounds(mv.getLatLon(0, mv.getHeight()), mv.getLatLon(mv.getWidth(), 0));
+        dontGeoreference = false;
 
         //Main.worker.execute(new DownloadWMSPlanImage(wmsLayer, bounds));
Index: applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java
===================================================================
--- applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 21478)
+++ applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/MenuActionGrabPlanImage.java	(revision 21493)
@@ -64,5 +64,8 @@
     public void actionInterrupted() {
         actionCompleted();
-        wmsLayer = null;
+        if (wmsLayer != null) {
+            Main.map.mapView.removeLayer(wmsLayer);
+            wmsLayer = null;
+        }
     }
 
@@ -101,5 +104,10 @@
         // wait until plan image is fully loaded and joined into one single image
         boolean loadedFromCache = downloadWMSPlanImage.waitFinished();
-        if (wmsLayer.images.size() == 1 && !loadedFromCache) {
+        if (loadedFromCache) {
+            Main.map.repaint();
+        } else if (wmsLayer.images.size() == 0) {
+            // action cancelled or image loaded from cache (and already georeferenced)
+            actionInterrupted();
+        } else {
             int reply = JOptionPane.CANCEL_OPTION;
             if (wmsLayer.isAlreadyGeoreferenced()) {
@@ -120,6 +128,5 @@
                     startGeoreferencing();
             }
-        } else // action cancelled or image loaded from cache (and already georeferenced)
-            Main.map.repaint();
+        }
     }
 
@@ -270,4 +277,5 @@
         		JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE,
         		null, options, options[0]);
+        countMouseClicked = 0;
         if (selectedValue == 0) { // "Cancel"
         	// remove layer
@@ -275,7 +283,6 @@
             wmsLayer = null;
             Main.map.mapView.removeMouseListener(this);
-        	return false;
-        } else
-            countMouseClicked = 0;
+            return false;
+        }
         return true;
     }
