Index: applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayer.java
===================================================================
--- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayer.java	(revision 24553)
+++ applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/ImageryLayer.java	(revision 24555)
@@ -17,4 +17,6 @@
     protected static final Icon icon =
         new ImageIcon(Toolkit.getDefaultToolkit().createImage(ImageryPlugin.class.getResource("/images/imagery_small.png")));
+
+    protected ImageryInfo info;
     protected MapView mv;
 
@@ -22,7 +24,8 @@
     protected double dy = 0.0;
 
-    public ImageryLayer(String name) {
-        super(name);
-        mv = Main.map.mapView;
+    public ImageryLayer(ImageryInfo info) {
+        super(info.getName());
+        this.info = info;
+        this.mv = Main.map.mapView;
     }
 
@@ -44,4 +47,8 @@
     public double getDy() {
         return dy;
+    }
+
+    public ImageryInfo getInfo() {
+        return info;
     }
 
Index: applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java
===================================================================
--- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java	(revision 24553)
+++ applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/tms/TMSLayer.java	(revision 24555)
@@ -178,5 +178,5 @@
     @SuppressWarnings("serial")
     public TMSLayer(ImageryInfo info) {
-        super(info.getName());
+        super(info);
 
         setBackgroundLayer(true);
@@ -191,5 +191,5 @@
         } else if (info.getImageryType() == ImageryType.BING) {
             initTileSource(new BingAerialTileSource());
-        } else throw new AssertionError();
+        } else throw new IllegalStateException("cannot create TMSLayer with non-TMS ImageryInfo");
 
         tileOptionMenu = new JPopupMenu();
@@ -380,5 +380,9 @@
     int getMaxZoomLvl()
     {
-        return TMSPreferences.getMaxZoomLvl(tileSource);
+        if (info.getMaxZoom() != 0) {
+            return TMSPreferences.checkMaxZoomLvl(info.getMaxZoom(), tileSource);
+        } else {
+            return TMSPreferences.getMaxZoomLvl(tileSource);
+        }
     }
 
Index: applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java
===================================================================
--- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java	(revision 24553)
+++ applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSAdapter.java	(revision 24555)
@@ -31,9 +31,9 @@
 
     public Grabber getGrabber(MapView mv, WMSLayer layer){
-        if(layer.info.getImageryType() == ImageryType.HTML)
+        if(layer.getInfo().getImageryType() == ImageryType.HTML)
             return new HTMLGrabber(mv, layer, cache);
-        else if(layer.info.getImageryType() == ImageryType.WMS)
+        else if(layer.getInfo().getImageryType() == ImageryType.WMS)
             return new WMSGrabber(mv, layer, cache);
-        else throw new AssertionError();
+        else throw new IllegalStateException("WMSAdapter.getGrabber() called for non-WMS layer type");
     }
 
Index: applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java
===================================================================
--- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java	(revision 24553)
+++ applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSGrabber.java	(revision 24555)
@@ -44,5 +44,5 @@
     WMSGrabber(MapView mv, WMSLayer layer, CacheFiles cache) {
         super(mv, layer, cache);
-        this.baseURL = layer.info.getURL();
+        this.baseURL = layer.getInfo().getURL();
         /* URL containing placeholders? */
         urlWithPatterns = isUrlWithPatterns(baseURL);
@@ -168,6 +168,6 @@
 
         HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        if(layer.info.getCookies() != null && !layer.info.getCookies().equals(""))
-            conn.setRequestProperty("Cookie", layer.info.getCookies());
+        if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().equals(""))
+            conn.setRequestProperty("Cookie", layer.getInfo().getCookies());
         conn.setRequestProperty("User-Agent", Main.pref.get("wmsplugin.user_agent", Version.getInstance().getAgentString()));
         conn.setConnectTimeout(Main.pref.getInteger("wmsplugin.timeout.connect", 30) * 1000);
Index: applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java
===================================================================
--- applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java	(revision 24553)
+++ applications/editors/josm/plugins/imagery/src/org/openstreetmap/josm/plugins/imagery/wms/WMSLayer.java	(revision 24555)
@@ -69,5 +69,4 @@
     protected boolean autoDownloadEnabled = true;
     protected boolean settingsChanged;
-    protected ImageryInfo info;
 
     // Image index boundary for current view
@@ -101,5 +100,5 @@
 
     public WMSLayer(ImageryInfo info) {
-        super(info.getName());
+        super(info);
         setBackgroundLayer(true); /* set global background variable */
         initializeImages();
