diff --git a/GUI/Model/Item/InstrumentItems.cpp b/GUI/Model/Item/InstrumentItems.cpp
index d7e720335fa571e9580dba9f3c1472e64538b61a..33cec30400795d98667da595598cad4f46594136 100644
--- a/GUI/Model/Item/InstrumentItems.cpp
+++ b/GUI/Model/Item/InstrumentItems.cpp
@@ -24,6 +24,7 @@
 #include "GUI/Model/Item/BackgroundItems.h"
 #include "GUI/Model/Item/BeamWavelengthItem.h"
 #include "GUI/Model/Item/DetectorItems.h"
+#include "GUI/Model/Item/ItemUtils.h"
 #include "GUI/Model/Item/PointwiseAxisItem.h"
 #include "GUI/Model/Item/RealDataItem.h"
 #include "GUI/Model/Item/RectangularDetectorItem.h"
@@ -83,20 +84,7 @@ InstrumentItem* InstrumentItem::createCopy() const
 {
     const auto type = InstrumentItemCatalog::type(this);
     auto* copy = InstrumentItemCatalog::create(type);
-
-    QByteArray a;
-    QXmlStreamWriter w(&a);
-    w.writeStartElement("start");
-    Serializer s(&w);
-    const_cast<InstrumentItem*>(this)->serialize(s);
-    w.writeEndElement();
-
-    QXmlStreamReader r(a);
-    Serializer sr(&r);
-    r.readNextStartElement();
-    ASSERT(r.name() == "start");
-    copy->serialize(sr);
-
+    GUI::Util::copyContents(this, copy);
     return copy;
 }
 
diff --git a/GUI/Model/Item/ItemUtils.h b/GUI/Model/Item/ItemUtils.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2815716c4e2abcdd9e203cbffddda6b0e2dbe3d
--- /dev/null
+++ b/GUI/Model/Item/ItemUtils.h
@@ -0,0 +1,49 @@
+//  ************************************************************************************************
+//
+//  BornAgain: simulate and fit reflection and scattering
+//
+//! @file      GUI/Model/Item/ItemUtils.h
+//! @brief     Defines GUI::Util namespace
+//!
+//! @homepage  http://www.bornagainproject.org
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2021
+//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
+//
+//  ************************************************************************************************
+
+#ifndef BORNAGAIN_GUI_MODEL_ITEM_ITEMUTILS_H
+#define BORNAGAIN_GUI_MODEL_ITEM_ITEMUTILS_H
+
+#include "Base/Util/Assert.h"
+
+namespace GUI::Util {
+
+template <typename T> QByteArray createBackup(const T* t)
+{
+    QByteArray backup;
+    QXmlStreamWriter w(&backup);
+    w.writeStartElement("backup");
+    Serializer s(&w);
+    const_cast<T*>(t)->serialize(s);
+    w.writeEndElement();
+    return backup;
+}
+
+template <typename T> void restoreBackup(T* t, const QByteArray& backup)
+{
+    QXmlStreamReader r(backup);
+    Serializer sr(&r);
+    r.readNextStartElement();
+    ASSERT(r.name() == "backup");
+    t->serialize(sr);
+}
+
+template <typename T> void copyContents(const T* source, T* dest)
+{
+    GUI::Util::restoreBackup(dest, GUI::Util::createBackup(source));
+}
+
+} // namespace GUI::Util
+
+#endif // BORNAGAIN_GUI_MODEL_ITEM_ITEMUTILS_H
diff --git a/GUI/Model/Item/MultiLayerItem.cpp b/GUI/Model/Item/MultiLayerItem.cpp
index 00d717990e5f1075422f6a9b1518f46e832c2905..f6adede79f84fbaf7098fa858369f389ef7cd3f6 100644
--- a/GUI/Model/Item/MultiLayerItem.cpp
+++ b/GUI/Model/Item/MultiLayerItem.cpp
@@ -13,6 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/Model/Item/MultiLayerItem.h"
+#include "GUI/Model/Item/ItemUtils.h"
 #include "GUI/Model/Item/LayerItem.h"
 #include "GUI/Model/XML/Serializer.h"
 #include <QXmlStreamWriter>
@@ -28,18 +29,7 @@ MultiLayerItem::MultiLayerItem()
 
 void MultiLayerItem::initFrom(const MultiLayerItem* other)
 {
-    QByteArray a;
-    QXmlStreamWriter w(&a);
-    w.writeStartElement("start");
-    Serializer s(&w);
-    const_cast<MultiLayerItem*>(other)->serialize(s);
-    w.writeEndElement();
-
-    QXmlStreamReader r(a);
-    Serializer sr(&r);
-    r.readNextStartElement();
-    ASSERT(r.name() == "start");
-    serialize(sr);
+    GUI::Util::copyContents(other, this);
 }
 
 QVector<ItemWithMaterial*> MultiLayerItem::itemsWithMaterial() const
diff --git a/GUI/View/Instrument/DistributionEditor.cpp b/GUI/View/Instrument/DistributionEditor.cpp
index 00132301d03fbd91d0b4b5110a766f84c8603951..2a60eecdeb728a485b4d1510bd51e17807ee1d54 100644
--- a/GUI/View/Instrument/DistributionEditor.cpp
+++ b/GUI/View/Instrument/DistributionEditor.cpp
@@ -15,9 +15,10 @@
 #include "GUI/View/Instrument/DistributionEditor.h"
 #include "GUI/Model/Item/BeamDistributionItem.h"
 #include "GUI/Model/Item/DistributionItems.h"
+#include "GUI/Model/Item/ItemUtils.h"
 #include "GUI/Model/MakeItem/DistributionItemCatalog.h"
-#include "GUI/Model/Model/SessionModel.h"
 #include "GUI/Model/Types/DoubleDescriptor.h"
+#include "GUI/Model/XML/Serializer.h"
 #include "GUI/View/Instrument/DistributionForms.h"
 #include "GUI/View/Instrument/EditDistributionDialog.h"
 #include "GUI/View/PropertyEditor/GroupInfoBox.h"
@@ -145,12 +146,12 @@ DistributionSelector::DistributionSelector(std::optional<MeanConfig> mean_config
     m_formLayout = new QFormLayout(this);
     m_formLayout->setMargin(0);
 
-    auto* distributionCombo =
+    m_distributionCombo =
         GUI::Util::createSelectionCombo(this, item->distributionSelection(), [=](int) {
             createDistributionWidgets();
             emit distributionChanged();
         });
-    m_formLayout->addRow("Distribution:", distributionCombo);
+    m_formLayout->addRow("Distribution:", m_distributionCombo);
 
     createDistributionWidgets();
 }
@@ -200,6 +201,8 @@ GUI::ID::Distributions DistributionSelector::distributions() const
 
 void DistributionSelector::refresh()
 {
+    QSignalBlocker b(m_distributionCombo);
+    m_distributionCombo->setCurrentIndex(m_item->distributionSelection().currentIndex());
     createDistributionWidgets();
 }
 
@@ -248,19 +251,20 @@ void showEditDistributionDialog(DistributionSelector* selector, const QString& t
     if (!item)
         return;
 
+    const QByteArray backup = GUI::Util::createBackup(item);
     bool modifiedInDialog = false;
 
-    SessionModel dummy("dummy");
-    BeamDistributionItem* distr_item =
-        dynamic_cast<BeamDistributionItem*>(dummy.copy(dynamic_cast<SessionItem*>(item)));
-    EditDistributionDialog dialog(distr_item, title, selector->meanConfig(),
-                                  selector->distributions(), selector);
+    EditDistributionDialog dialog(item, title, selector->meanConfig(), selector->distributions(),
+                                  selector);
 
     QObject::connect(&dialog, &EditDistributionDialog::distributionChanged,
                      [&] { modifiedInDialog = true; });
-    if (dialog.exec() == QDialog::Accepted && modifiedInDialog) {
-        assign(distr_item, item, selector->meanConfig().has_value());
-        selector->refresh();
-        selector->distributionChanged();
+    if (dialog.exec() != QDialog::Accepted)
+        GUI::Util::restoreBackup(item, backup);
+    else {
+        if (modifiedInDialog) {
+            selector->refresh();
+            selector->distributionChanged();
+        }
     }
 }
diff --git a/GUI/View/Instrument/DistributionEditor.h b/GUI/View/Instrument/DistributionEditor.h
index 587f8193685fe5a3f53932ee63f92f17dd192bf0..788a973ac5b769d09e353cdaeca3ad65af620dae 100644
--- a/GUI/View/Instrument/DistributionEditor.h
+++ b/GUI/View/Instrument/DistributionEditor.h
@@ -20,7 +20,6 @@
 
 class QComboBox;
 class QStackedLayout;
-
 class DistributionForm;
 class BeamDistributionItem;
 class QFormLayout;
@@ -70,6 +69,7 @@ private:
     std::optional<MeanConfig> m_meanConfig;
     GUI::ID::Distributions m_distributions;
     QFormLayout* m_formLayout;
+    QComboBox* m_distributionCombo;
 };
 
 
diff --git a/Tests/Unit/GUI/TestSessionXML.cpp b/Tests/Unit/GUI/TestSessionXML.cpp
index 3a3a9feb60ed7be0844229802d7dd20070140922..0a4d985c8d3b526a4198dd89ced13b3bb472960e 100644
--- a/Tests/Unit/GUI/TestSessionXML.cpp
+++ b/Tests/Unit/GUI/TestSessionXML.cpp
@@ -2,6 +2,7 @@
 #include "GUI/Model/Item/BackgroundItems.h"
 #include "GUI/Model/Item/FormFactorItems.h"
 #include "GUI/Model/Item/InstrumentItems.h"
+#include "GUI/Model/Item/ItemUtils.h"
 #include "GUI/Model/Item/LayerItem.h"
 #include "GUI/Model/Item/MultiLayerItem.h"
 #include "GUI/Model/Item/ParticleItem.h"
@@ -35,22 +36,12 @@ void itemFromXML(QString buffer, SessionItem* item)
 
 template <typename ItemType> QByteArray serialize(ItemType& t)
 {
-    QByteArray a;
-    QXmlStreamWriter w(&a);
-    w.writeStartElement("start");
-    Serializer s(&w);
-    t.serialize(s);
-    w.writeEndElement();
-    return a;
+    return GUI::Util::createBackup(&t);
 }
 
 template <typename ItemType> void deserialize(ItemType& t, const QByteArray& a)
 {
-    QXmlStreamReader r(a);
-    Serializer sr(&r);
-    r.readNextStartElement();
-    ASSERT_EQ(r.name().toString(), "start");
-    t.serialize(sr);
+    GUI::Util::restoreBackup(&t, a);
 }
 
 } // namespace