Index: trunk/MagicSoft/Mars/mfileio/MReadTree.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.cc	(revision 1477)
@@ -783,5 +783,5 @@
 // gui elements to a macro-file.
 //
-void MReadTree::SavePrimitive(ofstream &out, Option_t *o)
+void MReadTree::StreamPrimitive(ofstream &out) const
 {
     TString name = ToLower(fName);
Index: trunk/MagicSoft/Mars/mfileio/MReadTree.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MReadTree.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mfileio/MReadTree.h	(revision 1477)
@@ -36,4 +36,5 @@
 
     virtual void SetReadyToSave(Bool_t flag=kTRUE);
+    virtual void StreamPrimitive(ofstream &out) const;
 
     enum { kIsOwner = BIT(14) };
@@ -72,5 +73,4 @@
 
     virtual Bool_t Notify();
-    virtual void   SavePrimitive(ofstream &out, Option_t *o="");
 
     ClassDef(MReadTree, 1)	// Reads a tree from file(s)
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 1476)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 1477)
@@ -403,5 +403,5 @@
 // gui elements to a macro-file.
 //
-void MWriteRootFile::SavePrimitive(ofstream &out, Option_t *o)
+void MWriteRootFile::StreamPrimitive(ofstream &out) const
 {
     out << "   MWriteRootFile " << ToLower(fName) << "(\"";
@@ -416,7 +416,13 @@
     while ((entry=(MRootFileBranch*)Next()))
     {
-        out << "   " << ToLower(fName) << ".AddContainer(\"";
-        out << entry->GetContName() << "\", \"";
-        out << entry->GetName() << "\", \"";
+        if  (entry->GetContainer())
+        {
+            entry->GetContainer()->SavePrimitive(out);
+            out << "&" << ToLower(entry->GetContainer()->GetName());
+        }
+        else
+            out << "\"" << entry->GetContName() << "\"";
+
+        out << ", \"" << entry->GetName() << "\", \"";
         out << entry->GetTitle() << "\");" << endl;
     }
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 1476)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 1477)
@@ -19,5 +19,5 @@
     TBranch       *fBranch;     //!
 
-    MParContainer *fContainer;  //!
+    MParContainer *fContainer;
     TString        fContName;
 
@@ -74,4 +74,6 @@
     const char *GetFileName() const;
 
+    void StreamPrimitive(ofstream &out) const;
+
 public:
     MWriteRootFile();
@@ -92,5 +94,4 @@
 
     void Print(Option_t *t=NULL) const;
-    void SavePrimitive(ofstream &out, Option_t *o="");
 
     ClassDef(MWriteRootFile, 1)	// Class to write one container to a root file
