Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 11523)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 11527)
@@ -107,5 +107,6 @@
 
     private static final String[] OBSOLETE_PREF_KEYS = {
-      "hdop.factor" /* remove entry after April 2017 */
+      "hdop.factor", /* remove entry after April 2017 */
+      "imagery.layers.addedIds" /* remove entry after June 2017 */
     };
 
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11523)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 11527)
@@ -1033,5 +1033,5 @@
      */
     public void setNoTileHeaders(MultiMap<String, String> noTileHeaders) {
-       if (noTileHeaders == null) {
+       if (noTileHeaders == null || noTileHeaders.isEmpty()) {
            this.noTileHeaders = null;
        } else {
@@ -1053,5 +1053,5 @@
      */
     public void setNoTileChecksums(MultiMap<String, String> noTileChecksums) {
-        if (noTileChecksums == null) {
+        if (noTileChecksums == null || noTileChecksums.isEmpty()) {
             this.noTileChecksums = null;
         } else {
@@ -1073,5 +1073,9 @@
      */
     public void setMetadataHeaders(Map<String, String> metadataHeaders) {
-        this.metadataHeaders = metadataHeaders;
+        if (metadataHeaders == null || metadataHeaders.isEmpty()) {
+            this.metadataHeaders = null;
+        } else {
+            this.metadataHeaders = metadataHeaders;
+        }
     }
 
Index: trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java	(revision 11523)
+++ trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java	(revision 11527)
@@ -170,4 +170,5 @@
             updateEntriesFromDefaults();
             buildIdMap(layers, layerIds);
+            dropOldEntries();
         }
     }
@@ -232,26 +233,4 @@
         Main.pref.putCollection("imagery.layers.default", newKnownDefaults);
 
-        // Add ids to user entries without id.
-        // Only do this the first time for each id, so the user can have
-        // custom entries that don't get updated automatically
-        Collection<String> addedIds = Main.pref.getCollection("imagery.layers.addedIds");
-        Collection<String> newAddedIds = new TreeSet<>(addedIds);
-        for (ImageryInfo info : layers) {
-            for (ImageryInfo def : defaultLayers) {
-                if (isSimilar(def, info) && def.getId() != null && !addedIds.contains(def.getId())) {
-                    if (!defaultLayerIds.containsKey(def.getId())) {
-                        // ignore ids used more than once (have been purged from the map)
-                        continue;
-                    }
-                    newAddedIds.add(def.getId());
-                    if (info.getId() == null) {
-                        info.setId(def.getId());
-                        changed = true;
-                    }
-                }
-            }
-        }
-        Main.pref.putCollection("imagery.layers.addedIds", newAddedIds);
-
         // automatically update user entries with same id as a default entry
         for (int i = 0; i < layers.size(); i++) {
@@ -263,4 +242,5 @@
             if (matchingDefault != null && !matchingDefault.equalsPref(info)) {
                 layers.set(i, matchingDefault);
+                Main.info(tr("Update imagery ''{0}''", info.getName()));
                 changed = true;
             }
@@ -268,4 +248,26 @@
 
         if (changed) {
+            save();
+        }
+    }
+
+    /**
+     * Drop entries with Id which do no longer exist (removed from defaults).
+     */
+    public void dropOldEntries() {
+        List<String> drop = new ArrayList<>();
+
+        for (Map.Entry<String, ImageryInfo> info : layerIds.entrySet()) {
+            if (!defaultLayerIds.containsKey(info.getKey())) {
+                remove(info.getValue());
+                drop.add(info.getKey());
+                Main.info(tr("Drop old imagery ''{0}''", info.getValue().getName()));
+            }
+        }
+
+        if (!drop.isEmpty()) {
+            for (String id : drop) {
+                layerIds.remove(id);
+            }
             save();
         }
