Index: applications/editors/josm/plugins/reltoolbox/build.xml
===================================================================
--- applications/editors/josm/plugins/reltoolbox/build.xml	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/build.xml	(revision 33694)
@@ -4,5 +4,5 @@
     <property name="commit.message" value="RelToolbox: make natural sort for relation and find relation lists"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
-    <property name="plugin.main.version" value="12663"/>
+    <property name="plugin.main.version" value="12840"/>
 
     <property name="plugin.author" value="Ilya Zverev"/>
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/RelContextDialog.java	(revision 33694)
@@ -608,5 +608,5 @@
             if (property != null && property.length() > 0 && e.getSource() instanceof JCheckBoxMenuItem) {
                 boolean value = ((JCheckBoxMenuItem) e.getSource()).isSelected();
-                Main.pref.put(property, value);
+                Main.pref.putBoolean(property, value);
                 show(getInvoker(), getX(), getY());
             }
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateMultipolygonAction.java	(revision 33694)
@@ -124,5 +124,5 @@
         // for now, just copying standard action
         MultipolygonBuilder mpc = new MultipolygonBuilder();
-        String error = mpc.makeFromWays(getLayerManager().getEditDataSet().getSelectedWays());
+        String error = mpc.makeFromWays(ds.getSelectedWays());
         if (error != null) {
             JOptionPane.showMessageDialog(Main.parent, error);
@@ -159,5 +159,5 @@
             }
         }
-        list.add(new AddCommand(rel));
+        list.add(new AddCommand(ds, rel));
         MainApplication.undoRedo.add(new SequenceCommand(tr("Create multipolygon"), list));
 
@@ -166,5 +166,5 @@
         }
 
-        getLayerManager().getEditDataSet().setSelected(rel);
+        ds.setSelected(rel);
     }
 
@@ -335,5 +335,5 @@
         }
 
-        for (String linearTag : Main.pref.getCollection(PREF_MULTIPOLY + "lineartags", DEFAULT_LINEAR_TAGS)) {
+        for (String linearTag : Main.pref.getList(PREF_MULTIPOLY + "lineartags", DEFAULT_LINEAR_TAGS)) {
             values.remove(linearTag);
         }
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/CreateRelationAction.java	(revision 33694)
@@ -22,4 +22,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
 import org.openstreetmap.josm.data.osm.Relation;
@@ -64,9 +65,10 @@
             rel.put("type", type);
         }
-        for (OsmPrimitive selected : getLayerManager().getEditDataSet().getSelected()) {
+        DataSet ds = getLayerManager().getEditDataSet();
+        for (OsmPrimitive selected : ds.getSelected()) {
             rel.addMember(new RelationMember("", selected));
         }
 
-        MainApplication.undoRedo.add(new AddCommand(rel));
+        MainApplication.undoRedo.add(new AddCommand(ds, rel));
 
         if (chRel != null) {
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DeleteChosenRelationAction.java	(revision 33694)
@@ -33,5 +33,5 @@
         Relation r = rel.get();
         rel.clear();
-        Command c = DeleteCommand.delete(MainApplication.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
+        Command c = DeleteCommand.delete(Collections.singleton(r), true, true);
         if (c != null) {
             MainApplication.undoRedo.add(c);
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DuplicateChosenRelationAction.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DuplicateChosenRelationAction.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/DuplicateChosenRelationAction.java	(revision 33694)
@@ -9,4 +9,5 @@
 
 import org.openstreetmap.josm.command.AddCommand;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.gui.MainApplication;
@@ -17,5 +18,5 @@
 
 public class DuplicateChosenRelationAction extends AbstractAction implements ChosenRelationListener {
-    private ChosenRelation rel;
+    private final ChosenRelation rel;
 
     public DuplicateChosenRelationAction(ChosenRelation rel) {
@@ -30,10 +31,11 @@
     @Override
     public void actionPerformed(ActionEvent e) {
-        Relation r = rel.get();
-        Relation copy = new Relation(r, true);
-        MainApplication.undoRedo.add(new AddCommand(copy));
-        rel.set(copy);
-        if (MainApplication.getLayerManager().getEditDataSet() != null) {
-            MainApplication.getLayerManager().getEditDataSet().setSelected(copy);
+        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
+        if (ds != null) {
+            Relation r = rel.get();
+            Relation copy = new Relation(r, true);
+            MainApplication.undoRedo.add(new AddCommand(ds, copy));
+            rel.set(copy);
+            ds.setSelected(copy);
         }
     }
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/ReconstructPolygonAction.java	(revision 33694)
@@ -24,4 +24,5 @@
 import org.openstreetmap.josm.command.SequenceCommand;
 import org.openstreetmap.josm.data.coor.EastNorth;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.MultipolygonBuilder;
@@ -85,9 +86,9 @@
         List<OsmPrimitive> newSelection = new ArrayList<>();
         List<Command> commands = new ArrayList<>();
-        Command relationDeleteCommand = DeleteCommand.delete(
-                MainApplication.getLayerManager().getEditLayer(), Collections.singleton(r), true, true);
+        Command relationDeleteCommand = DeleteCommand.delete(Collections.singleton(r), true, true);
         if (relationDeleteCommand == null)
             return;
 
+        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
         for (JoinedPolygon p : mpc.outerWays) {
 
@@ -123,5 +124,5 @@
                 }
                 if (relationReused) {
-                    commands.add(new AddCommand(n));
+                    commands.add(new AddCommand(ds, n));
                 } else {
                     relationReused = true;
@@ -189,5 +190,5 @@
             result.setKeys(tags);
             newSelection.add(candidateWay == null ? result : candidateWay);
-            commands.add(candidateWay == null ? new AddCommand(result) : new ChangeCommand(candidateWay, result));
+            commands.add(candidateWay == null ? new AddCommand(ds, result) : new ChangeCommand(candidateWay, result));
         }
 
@@ -199,5 +200,5 @@
         MainApplication.undoRedo.add(new SequenceCommand(tr("Reconstruct polygons from relation {0}",
                 r.getDisplayName(DefaultNameFormatter.getInstance())), commands));
-        MainApplication.getLayerManager().getEditDataSet().setSelected(newSelection);
+        ds.setSelected(newSelection);
     }
 
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/SplittingMultipolygons.java	(revision 33694)
@@ -20,4 +20,5 @@
 import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
 import org.openstreetmap.josm.data.osm.Node;
@@ -218,4 +219,5 @@
         }
 
+        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
         for (int i = 1; i < chunks.size(); i++) {
             List<Node> achunk = chunks.get(i);
@@ -229,5 +231,5 @@
             newWay.setNodes(achunk);
             if (commands != null) {
-                commands.add(new AddCommand(newWay));
+                commands.add(new AddCommand(ds, newWay));
             }
         }
@@ -273,5 +275,5 @@
         newRelation.put("type", "multipolygon");
         newRelation.addMember(new RelationMember("outer", segment));
-        Collection<String> linearTags = Main.pref.getCollection(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
+        Collection<String> linearTags = Main.pref.getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
         Way segmentCopy = new Way(segment);
         boolean changed = false;
@@ -307,5 +309,5 @@
         }
         newRelation.addMember(new RelationMember("outer", addingWay.getUniqueId() == target.getUniqueId() ? target : addingWay));
-        commands.add(new AddCommand(newRelation));
+        commands.add(new AddCommand(MainApplication.getLayerManager().getEditDataSet(), newRelation));
         resultingCommands.add(new SequenceCommand(tr("Complete multipolygon for way {0}",
                 DefaultNameFormatter.getInstance().format(segment)), commands));
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/actions/TheRing.java	(revision 33694)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.DeleteCommand;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -22,4 +23,5 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 import org.openstreetmap.josm.tools.Geometry;
 import org.openstreetmap.josm.tools.Geometry.PolygonIntersection;
@@ -329,5 +331,5 @@
         Way sourceCopy = new Way(source);
         if (createMultipolygon) {
-            Collection<String> linearTags = Main.pref.getCollection(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
+            Collection<String> linearTags = Main.pref.getList(PREF_MULTIPOLY + "lineartags", CreateMultipolygonAction.DEFAULT_LINEAR_TAGS);
             relation = new Relation();
             relation.put("type", "multipolygon");
@@ -369,4 +371,5 @@
         }
 
+        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
         List<Command> commands = new ArrayList<>();
         boolean foundOwnWay = false;
@@ -375,5 +378,5 @@
             Way w = seg.constructWay(seg.isReference() ? null : sourceCopy);
             if (needAdding) {
-                commands.add(new AddCommand(w));
+                commands.add(new AddCommand(ds, w));
             }
             if (w.equals(source)) {
@@ -398,5 +401,5 @@
         commands.addAll(relationCommands);
         if (createMultipolygon) {
-            commands.add(new AddCommand(relation));
+            commands.add(new AddCommand(ds, relation));
         }
         return commands;
Index: applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java
===================================================================
--- applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java	(revision 33693)
+++ applications/editors/josm/plugins/reltoolbox/src/relcontext/relationfix/MultipolygonFixer.java	(revision 33694)
@@ -17,4 +17,5 @@
 import org.openstreetmap.josm.data.osm.RelationMember;
 import org.openstreetmap.josm.data.osm.Way;
+import org.openstreetmap.josm.gui.MainApplication;
 
 /**
@@ -46,5 +47,5 @@
     public Command fixRelation(Relation rel) {
         Relation rr = fixMultipolygonRoles(rel);
-        return rr != null ? new ChangeCommand(rel, rr) : null;
+        return rr != null ? new ChangeCommand(MainApplication.getLayerManager().getEditDataSet(), rel, rr) : null;
     }
 
@@ -82,7 +83,7 @@
             if (m.isWay()) {
                 String role = null;
-                if (outerWays.contains((Way)m.getMember())) {
+                if (outerWays.contains(m.getMember())) {
                     role = "outer";
-                } else if (innerWays.contains((Way)m.getMember())) {
+                } else if (innerWays.contains(m.getMember())) {
                     role = "inner";
                 }
