Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 29317)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/DrawnPolyLine.java	(revision 29453)
@@ -9,5 +9,4 @@
 import java.util.Set;
 import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.gui.MapView;
 
@@ -94,5 +93,5 @@
 
     void addFixed(LatLon coor) {
-         addLast(coor);
+        addLast(coor);
         fixed.add(coor);
     }
@@ -100,10 +99,15 @@
         if (closedFlag && lastIdx>points.size()-1) return;
         if (lastIdx>=points.size()-1) {
-            //System.out.println("add last "+points.size());
-            points.addLast(coor);if (points.size()>1) lastIdx++;
-            //System.out.println("lastIdx="+lastIdx);
-            }
-        else {points.add(lastIdx+1, coor); lastIdx++; 
-            //System.out.println("add at "+lastIdx+"/"+points.size());
+            // 
+            if (points.isEmpty() || !coor.equals(points.getLast())) {
+                points.addLast(coor); 
+                if (points.size()>1) lastIdx++;
+                }
+        } else {
+            // insert point into midlle of the line
+            if (points.isEmpty() || !coor.equals(points.get(lastIdx))) {
+                points.add(lastIdx+1, coor); 
+                lastIdx++; 
+            }
         }
     }
Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java	(revision 29317)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FDSettings.java	(revision 29453)
@@ -50,6 +50,6 @@
         //deltaLatLon = Main.pref.getDouble("fastdraw.deltasearch", 0.01);
         minPixelsBetweenPoints = Main.pref.getDouble("fastdraw.mindelta", 20);
-        startingEps = Main.pref.getDouble("fastdraw.startingEps", 0.1);
-        maxPointsPerKm = Main.pref.getDouble("fastdraw.maxpkm", 20);
+        startingEps = Main.pref.getDouble("fastdraw.startingEps", 5);
+        maxPointsPerKm = Main.pref.getDouble("fastdraw.maxpkm", 150);
         pkmBlockSize = Main.pref.getInteger("fastdraw.pkmblocksize", 10);
         drawLastSegment = Main.pref.getBoolean("fastdraw.drawlastsegment", true);
Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java	(revision 29317)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawConfigDialog.java	(revision 29453)
@@ -1,6 +1,2 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
 package org.openstreetmap.josm.plugins.fastdraw;
 
Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 29317)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 29453)
@@ -1,6 +1,3 @@
 /*
- * This file is part of ImproveWayAccuracy plugin for JOSM.
- * http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImproveWayAccuracy
- *
  * Licence: GPL v2 or later
  * Author:  Alexei Kasatkin, 2011
@@ -13,19 +10,10 @@
 import java.awt.BasicStroke;
 import java.awt.Color;
-import java.awt.Point;
-import java.awt.event.MouseEvent;
-import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.data.osm.Tag;
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 import java.awt.Cursor;
 import java.awt.Graphics2D;
+import java.awt.Point;
 import java.awt.Stroke;
 import java.awt.Toolkit;
-import java.awt.event.AWTEventListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.InputEvent;
-import java.awt.event.KeyEvent;
+import java.awt.event.*;
 import java.util.*;
 import javax.swing.JOptionPane;
@@ -40,4 +28,6 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.Bounds;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.Tag;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -52,4 +42,6 @@
 import org.openstreetmap.josm.tools.Shortcut;
 import org.openstreetmap.josm.tools.TextTagParser;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
 
 class FastDrawingMode extends MapMode implements MapViewPaintable,
@@ -91,5 +83,8 @@
     private boolean lineWasSaved;
     private boolean deltaChanged;
-    private final int mainKeyCode;
+    /**
+     * used for skipping keyboard AWTTevents while dialogs are active
+     */
+    private boolean listenKeys = false;
     
     FastDrawingMode(MapFrame mapFrame) {
@@ -105,5 +100,4 @@
         cursorDrawing = ImageProvider.getCursor("crosshair", "mode");
         //loadPrefs();
-        mainKeyCode = getShortcut().getKeyStroke().getKeyCode();
     }
 
@@ -147,4 +141,5 @@
         });
         
+        listenKeys = true;
         try {
             Toolkit.getDefaultToolkit().addAWTEventListener(this,
@@ -265,5 +260,5 @@
     @Override
     public void eventDispatched(AWTEvent event) {
-        if (Main.map == null || Main.map.mapView == null
+        if (!listenKeys || Main.map == null || Main.map.mapView == null
                 || !Main.map.mapView.isActiveLayerDrawable()) {
             return;
@@ -485,5 +480,4 @@
         break;
         case KeyEvent.VK_ESCAPE:
-            // less details
             e.consume();
             Point lastPoint = line.getLastPoint();
@@ -491,10 +485,13 @@
             if (lastPoint==null || lastPoint.equals(line.getLastPoint())) {
                  if (line.getPoints().size()>5) {
-                 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
-                    "delete_drawn_line", Main.parent,
-                    tr("Are you sure you do not want to save the line containing {0} points?",
-                         line.getPoints().size()), tr("Delete confirmation"),
-                    JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_OPTION );
-                 if(!answer) break;
+                    // no key events while the dialog is active!
+                    listenKeys = false;
+                    boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog(
+                       "delete_drawn_line", Main.parent,
+                       tr("Are you sure you do not want to save the line containing {0} points?",
+                            line.getPoints().size()), tr("Delete confirmation"),
+                       JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_OPTION );
+                    listenKeys = true;
+                    if(!answer) break;
                 }
                 newDrawing(); // stop drawing
@@ -505,4 +502,5 @@
         
         case KeyEvent.VK_I:
+           listenKeys = false;
            JOptionPane.showMessageDialog(Main.parent,
                         tr("{0} m - length of the line\n{1} nodes\n{2} points per km (maximum)\n{3} points per km (average)",
@@ -510,4 +508,5 @@
                         line.getNodesPerKm(1000000)),
                         tr("Line information"),JOptionPane.INFORMATION_MESSAGE);
+           listenKeys = true;
         break;            
         case KeyEvent.VK_Q:
@@ -515,5 +514,5 @@
             e.consume();
             try {
-                Toolkit.getDefaultToolkit().removeAWTEventListener(this);
+                listenKeys = false;
                 new FastDrawConfigDialog(settings);
                 if (line.wasSimplified()) {
@@ -522,6 +521,5 @@
                 }
                 //System.out.println("final eps="+eps);
-                Toolkit.getDefaultToolkit().addAWTEventListener(this,
-                    AWTEvent.KEY_EVENT_MASK);
+                listenKeys = true;
             } catch (SecurityException ex) {  }
             repaint();
@@ -560,4 +558,5 @@
 // <editor-fold defaultstate="collapsed" desc="Different action helper methods">
     public void newDrawing() {
+        if (delCmd!=null) delCmd.undoCommand();
         delCmd=null; oldNodes=null;
         eps=settings.startingEps;
@@ -580,9 +579,9 @@
         for (LatLon p : pts) {
             Node nd=null;
-            //if (line.isFixed(p)) {
-                // there may be a node with same ccoords!
-                nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isSelectablePredicate);
-            //}
-            if (nd!=null) if (p.greatCircleDistance(nd.getCoor())>0.01) nd=null;
+ 
+            nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isSelectablePredicate);
+            // there may be a node with the same coords!
+            
+            if (nd!=null && p.greatCircleDistance(nd.getCoor())>0.01) nd=null;
             if (nd==null) {
                 if (i>0 && p.equals(first)) nd=firstNode; else {
@@ -627,4 +626,5 @@
                 }
             }
+            delCmd = null; // that is all with this command
             cmds.add(new AddCommand(w));
         } else cmds.add(new AddCommand(w));
Index: applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java
===================================================================
--- applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 29317)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingPlugin.java	(revision 29453)
@@ -1,6 +1,3 @@
 /*
- * This file is part of ImproveWayAccuracy plugin for JOSM.
- * http://wiki.openstreetmap.org/wiki/JOSM/Plugins/ImproveWayAccuracy
- *
  * Licence: GPL v2 or later
  * Author:  Alexei Kasatkin, 2011
