Index: /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java
===================================================================
--- /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java	(revision 28621)
+++ /applications/editors/josm/plugins/ElevationProfile/src/org/openstreetmap/josm/plugins/elevation/ElevationProfilePlugin.java	(revision 28622)
@@ -29,5 +29,5 @@
  */
 public class ElevationProfilePlugin extends Plugin {
-	protected static ElevationProfileDialog eleProfileDlg;
+	
 	private ElevationMapMode eleMode;
 	private IconToggleButton eleModeButton;
@@ -42,6 +42,4 @@
 
 		try {
-			eleProfileDlg = new ElevationProfileDialog();
-			
 			eleMode = new ElevationMapMode("Elevation profile", Main.map);
 			eleModeButton = new IconToggleButton(eleMode);
@@ -62,11 +60,9 @@
 		
 		if (newFrame != null) {
+			newFrame.toolGroup.add(eleModeButton);
+			ElevationProfileDialog eleProfileDlg = new ElevationProfileDialog();
+			eleProfileDlg.addModelListener(eleMode);
+			eleProfileDlg.setProfileLayer(getCurrentLayer());
 			newFrame.addToggleDialog(eleProfileDlg);
-			eleProfileDlg.addModelListener(eleMode);			
-		}
-		
-		if(Main.map != null){
-			Main.map.toolGroup.add(eleModeButton);
-			eleProfileDlg.setProfileLayer(getCurrentLayer());
 		}
 	}
