Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/StringUtils.java	(revision 16417)
@@ -62,4 +62,5 @@
         s1 = anglicize(s1);
         s2 = anglicize(s2);
+
         List<Integer> beg1 = new ArrayList<Integer>(4);
         List<Integer> beg2 = new ArrayList<Integer>(4);
@@ -114,6 +115,4 @@
      * others lower-case). Czech grammar rules are more or less obeyed.
      *
-     * <p><b>TODO:</b> This should be moved somewhere else.</p>
-     *
      * @param s string to be capitalized
      * @return capitaized string
@@ -135,11 +134,29 @@
             last = charr[i] = ch;
         }
+        String result = String.valueOf(charr);
+
+        result = result.replaceAll("Nábř. ", "nábřeží ");
+        result = result.replaceAll("Ul. ",   "ulice ");
+        result = result.replaceAll("Nám. ",  "náměstí ");
+        result = result.replaceAll("Kpt. ",  "kapitána ");
+        result = result.replaceAll("Bří. ",  "bratří ");
 
         String[] noCapitalize = { "Nad", "Pod", "U", "Na", "Z" };
-        String result = String.valueOf(charr);
-
         for (String noc : noCapitalize)
             result = result.replaceAll(" "+noc+" ", " "+noc.toLowerCase()+" ");
-        return result;
+
+
+        String[] mesice = {"Ledna", "Února", "Března", "Dubna", "Května",
+            "Máje", "Června", "Července", "Srpna", "Září", "Října",
+            "Listopadu", "Prosince"};
+        for (String mesic : mesice)
+            result = result.replaceAll("."+mesic, ". " + mesic.toLowerCase());
+
+
+        String[] noBegCap = {"Třída", "Ulice", "Náměstí", "Nábřeží"};
+        for (String noc : noBegCap)
+            result = result.replaceAll(noc, noc.toLowerCase());
+
+        return result.replaceAll("  ", " ");
     }
 
Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/addressdatabase/AddressElement.java	(revision 16417)
@@ -101,4 +101,7 @@
             result += " " + StringUtils.latLonToString(((Way) prim).firstNode().getCoor());
 
+        if (prim.deleted)
+            result += " DEL";
+
         return result;
     }
Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/LocationSelector.java	(revision 16417)
@@ -17,5 +17,4 @@
 import org.openstreetmap.josm.plugins.czechaddress.addressdatabase.Region;
 import org.openstreetmap.josm.Main;
-import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.osm.Node;
@@ -61,5 +60,7 @@
                 Database.getInstance().regions.toArray()));
 
-        autodetectLocation();
+        try {
+            autodetectLocation();
+        } catch (Exception e) {}
         oblastComboBoxItemStateChanged(null);
     }
Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/ManagerDialog.java	(revision 16417)
@@ -327,5 +327,12 @@
 
     private void dbTreeValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_dbTreeValueChanged
-        dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent();
+        try {
+            dbTreeValue = (AddressElement) dbTree.getSelectionPath().getLastPathComponent();
+        } catch (NullPointerException except) {
+            dbTreeValue = null;
+            System.err.println("Strange exception has occured."+
+                " If you find a way to reproduce it, please report a bug!");
+            except.printStackTrace();
+        }
         dbEditButton.setEnabled( EditorFactory.isEditable(dbTreeValue) );
     }//GEN-LAST:event_dbTreeValueChanged
Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/gui/PointManipulatorDialog.java	(revision 16417)
@@ -90,5 +90,5 @@
         if (getValue() == 1) {
             
-            if (updateMatchesTimer.isRunning()) {
+            if (updateMatchesTimer != null && updateMatchesTimer.isRunning()) {
                 updateMatchesTimer.stop();
                 updateMatches();
@@ -135,4 +135,6 @@
             Map<String,String> backup = prim.keys;
             r.openTransaction();
+            for (AddressElement elem : r.getCandidates(prim))
+                r.unOverwrite(prim, elem);
             prim.keys = null;
             prim.put(PrimUtils.KEY_ADDR_CP, alternateNumberEdit.getText());
Index: applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java
===================================================================
--- applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java	(revision 16290)
+++ applications/editors/josm/plugins/czechaddress/src/org/openstreetmap/josm/plugins/czechaddress/intelligence/Reasoner.java	(revision 16417)
@@ -541,24 +541,33 @@
      */
     public AddressElement getStrictlyBest(OsmPrimitive prim) {
-
-        if (!transactionOpened)
-            return primBestIndex.get(prim);
-
-        Map<AddressElement, Integer> matches = primMatchIndex.get(prim);
-        if (matches == null) return null;
-        AddressElement bestE = null;
-        int bestQ = MATCH_NOMATCH;
-
-        for (AddressElement elem : matches.keySet()) {
-            if (matches.get(elem) == bestQ)
-                bestE = null;
-
-            if (matches.get(elem) > bestQ) {
-                bestQ = matches.get(elem);
-                bestE = elem;
+        
+        AddressElement result = null;
+        try {
+            if (!transactionOpened)
+                return primBestIndex.get(prim);
+
+            Map<AddressElement, Integer> matches = primMatchIndex.get(prim);
+            if (matches == null) {
+                return null;
             }
-        }
-
-        return bestE;
+
+            int bestQ = MATCH_NOMATCH;
+            for (AddressElement elem : matches.keySet()) {
+                if (matches.get(elem) == bestQ)
+                    result = null;
+
+                if (matches.get(elem) > bestQ) {
+                    bestQ = matches.get(elem);
+                    result = elem;
+                }
+            }
+            
+        } catch (NullPointerException except) {
+            System.err.println("Strange exception occured." +
+                " If you find a way to reproduce this situation, please "+
+                "e-mail the author of the CzechAddress plugin.");
+            except.printStackTrace();
+        }
+        return result;
     }
 
@@ -582,23 +591,33 @@
     public OsmPrimitive getStrictlyBest(AddressElement elem) {
 
-        if (!transactionOpened)
-            return elemBestIndex.get(elem);
-
-        Map<OsmPrimitive, Integer> matches = elemMatchIndex.get(elem);
-        if (matches == null) return null;
-        OsmPrimitive bestE = null;
-        int bestQ = MATCH_NOMATCH;
-
-        for (OsmPrimitive prim : matches.keySet()) {
-            if (matches.get(prim) == bestQ)
-                bestE = null;
-
-            if (matches.get(prim) > bestQ) {
-                bestQ = matches.get(prim);
-                bestE = prim;
+        OsmPrimitive result = null;
+        try {
+            if (!transactionOpened)
+                return elemBestIndex.get(elem);
+
+            Map<OsmPrimitive, Integer> matches = elemMatchIndex.get(elem);
+            if (matches == null) {
+                return null;
             }
-        }
-
-        return bestE;
+            
+            int bestQ = MATCH_NOMATCH;
+            for (OsmPrimitive prim : matches.keySet()) {
+                if (matches.get(prim) == bestQ) {
+                    result = null;
+                }
+
+                if (matches.get(prim) > bestQ) {
+                    bestQ = matches.get(prim);
+                    result = prim;
+                }
+            }
+
+        } catch (NullPointerException except) {
+            System.err.println("Strange exception occured." +
+                " If you find a way to reproduce this situation, please "+
+                "e-mail the author of the CzechAddress plugin.");
+            except.printStackTrace();
+        }
+        return result;
     }
 
