Index: trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java	(revision 10543)
+++ trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java	(revision 10545)
@@ -387,12 +387,17 @@
         } catch (IOException e) {
             log.log(Level.FINE, "JCS - IOExecption during communication with server for: {0}", getUrlNoException());
-            attributes.setError(e);
-            attributes.setResponseCode(499); // set dummy error code
-            boolean doCache = isResponseLoadable(null, 499, null) || cacheAsEmpty(); //generic 499 error code returned
-            if (doCache) {
-                cacheData = createCacheEntry(new byte[]{});
-                cache.put(getCacheKey(), createCacheEntry(new byte[]{}), attributes);
-            }
-            return doCache;
+            if (isObjectLoadable()) {
+                return true;
+            } else {
+                attributes.setError(e);
+                attributes.setResponseCode(499); // set dummy error code
+                boolean doCache = isResponseLoadable(null, 499, null) || cacheAsEmpty(); //generic 499 error code returned
+                if (doCache) {
+                    cacheData = createCacheEntry(new byte[]{});
+                    cache.put(getCacheKey(), createCacheEntry(new byte[]{}), attributes);
+                }
+                return doCache;
+            }
+
         } catch (InterruptedException e) {
             attributes.setError(e);
Index: trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 10543)
+++ trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java	(revision 10545)
@@ -703,5 +703,5 @@
         int ret = (int) Math.ceil(
                 Math.pow(2d, ZOOM_OFFSET.get()) * visibileTiles // use offset to decide, how many tiles are visible
-                * 2);
+                * 4);
         Main.info("AbstractTileSourceLayer: estimated visible tiles: {0}, estimated cache size: {1}", visibileTiles, ret);
         return ret;
@@ -1205,5 +1205,5 @@
 
 
-    private final TileSet nullTileSet = new TileSet((LatLon) null, (LatLon) null, 0);
+    private final TileSet nullTileSet = new TileSet();
 
     private final class MapWrappingTileSet extends TileSet {
@@ -1254,9 +1254,20 @@
             TileXY t2 = tileSource.latLonToTileXY(botRight.toCoordinate(), zoom);
 
-            x0 = t1.getXIndex();
-            y0 = t1.getYIndex();
-            x1 = t2.getXIndex();
-            y1 = t2.getYIndex();
+            x0 = (int) Math.floor(t1.getX());
+            y0 = (int) Math.floor(t1.getY());
+            x1 = (int) Math.ceil(t2.getX());
+            y1 = (int) Math.ceil(t2.getY());
             sanitize();
+
+        }
+
+        private TileSet(Tile topLeft, Tile botRight, int zoom) {
+        }
+
+        /**
+         * null tile set
+         */
+        private TileSet() {
+            return;
         }
 
@@ -1390,4 +1401,9 @@
             }
         }
+
+        @Override
+        public String toString() {
+            return getClass().getName() + ": zoom: " + zoom + " X(" + x0 + ", " + x1 + ") Y(" + y0 + ", " + y1 + ") size: " + size();
+        }
     }
 
@@ -1558,7 +1574,8 @@
                 }
                 Tile t2 = tempCornerTile(missed);
-                LatLon topLeft2 = getShiftedLatLon(tileSource.tileXYToLatLon(missed));
-                LatLon botRight2 = getShiftedLatLon(tileSource.tileXYToLatLon(t2));
-                TileSet ts2 = new TileSet(topLeft2, botRight2, newzoom);
+                TileSet ts2 = new TileSet(
+                        getShiftedLatLon(tileSource.tileXYToLatLon(missed)),
+                        getShiftedLatLon(tileSource.tileXYToLatLon(t2)),
+                        newzoom);
                 // Instantiating large TileSets is expensive.  If there
                 // are no loaded tiles, don't bother even trying.
