Index: trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc	(revision 3336)
@@ -188,5 +188,5 @@
 // a warning message is print.
 //
-void MWriteAsciiFile::CheckAndWrite() const
+Bool_t MWriteAsciiFile::CheckAndWrite() const
 {
     Bool_t written = kFALSE;
@@ -219,11 +219,12 @@
     }
 
-    if (!written)
-        return;
-
-    *fOut << endl;
-
-    if (num!=0)
-        *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl;
+    if (written)
+    {
+        *fOut << endl;
+
+        if (num!=0)
+            *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl;
+    }
+    return kTRUE;
 }
 
Index: trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h	(revision 3336)
@@ -21,5 +21,5 @@
     TObjArray fAutoDel; //! List of object to be deleted in the destructor
 
-    virtual void   CheckAndWrite() const;
+    virtual Bool_t CheckAndWrite() const;
     virtual Bool_t IsFileOpen() const;
     virtual Bool_t GetContainer(MParList *pList);
Index: trunk/MagicSoft/Mars/mfileio/MWriteFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteFile.cc	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteFile.cc	(revision 3336)
@@ -78,7 +78,5 @@
     // write the container if it is already in changed state
     //
-    CheckAndWrite();
-
-    return kTRUE;
+    return CheckAndWrite();
 }
 
@@ -90,6 +88,5 @@
 Bool_t MWriteFile::ReInit(MParList *pList)
 {
-    CheckAndWrite();
-    return kTRUE;
+    return CheckAndWrite();
 }
 
@@ -101,6 +98,5 @@
 Int_t MWriteFile::Process()
 {
-    CheckAndWrite();
-    return kTRUE;
+    return CheckAndWrite();
 }
 
@@ -115,5 +111,4 @@
     // check if the container changed state is set
     //
-    CheckAndWrite();
-    return kTRUE;
+    return CheckAndWrite();
 }
Index: trunk/MagicSoft/Mars/mfileio/MWriteFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteFile.h	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteFile.h	(revision 3336)
@@ -15,5 +15,5 @@
 
     virtual Bool_t      IsFileOpen() const = 0;
-    virtual void        CheckAndWrite() const = 0;
+    virtual Bool_t      CheckAndWrite() const = 0;
     virtual Bool_t      GetContainer(MParList *pList) = 0;
     virtual const char *GetFileName() const = 0;
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc	(revision 3336)
@@ -338,40 +338,43 @@
         entry->SetTree(tree);
 
+        TString branchname(cname);
+        branchname.Append(".");
+
         //
         // Try to get the branch from the file. 
         // If the branch already exists the user specified one branch twice.
         //
-        TBranch *branch = tree->GetBranch(cname);
+        TBranch *branch = tree->GetBranch(branchname);
         if (branch)
         {
-            *fLog << err << "Branch '" << cname << "' already existing." << endl;
-            return kFALSE;
-        }
-
-        //
-        // Create a new branch in the actual tree. The branch has the name
-        // container name. The type of the container is given by the
-        // ClassName entry in the container. The Address is the address of a
-        // pointer to the container (gotten from the branch entry). As
-        // Basket size we specify a (more or less) common default value.
-        // The containers should be written in Splitlevel=1
-        //
-        *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName() << "... " << flush;
-
-        TString branchname(cname);
-        branchname.Append(".");
-        branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());
-
-        //
-        // If the branch couldn't be created we have a problem.
-        //
-        if (!branch)
-        {
-            *fLog << endl;
-            *fLog << err << "Unable to create branch '" << cname << "'." << endl;
-            return kFALSE;
-        }
-
-        *fLog << "done." << endl;
+            *fLog << inf << "Branch '" << cname << "' already existing... updating." << endl;
+            branch->SetAddress(entry->GetAddress());
+        }
+        else
+        {
+            //
+            // Create a new branch in the actual tree. The branch has the name
+            // container name. The type of the container is given by the
+            // ClassName entry in the container. The Address is the address of a
+            // pointer to the container (gotten from the branch entry). As
+            // Basket size we specify a (more or less) common default value.
+            // The containers should be written in Splitlevel=1
+            //
+            *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName();
+            *fLog << " in tree " << tree->GetName() << "... " << flush;
+
+            branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());
+            //
+            // If the branch couldn't be created we have a problem.
+            //
+            if (!branch)
+            {
+                *fLog << endl;
+                *fLog << err << "Unable to create branch '" << cname << "'." << endl;
+                return kFALSE;
+            }
+
+            *fLog << "done." << endl;
+        }
 
         //
@@ -398,5 +401,5 @@
 // has the write flag, all containers in this tree are filled!
 //
-void MWriteRootFile::CheckAndWrite() const
+Bool_t MWriteRootFile::CheckAndWrite() const
 {
     TObject *obj;
@@ -423,5 +426,11 @@
             b->GetTree()->SetBit(kFillTree);
         else
-            b->GetBranch()->Fill();
+        {
+            if (!b->GetBranch()->Fill())
+            {
+                *fLog << err << "ERROR - Zero bytes written to branch '" << b->GetBranch()->GetName() << "'... abort." << endl;
+                return kFALSE;
+            }
+        }
     }
 
@@ -445,7 +454,12 @@
         // of written/filled entries.
         //
-        t->Fill();
         t->ResetBit(kFillTree);
-    }
+        if (!t->Fill())
+        {
+            *fLog << err << "ERROR - Zero bytes written to tree '" << t->GetName() << "'... abort." << endl;
+            return kFALSE;
+        }
+    }
+    return kTRUE;
 }
 
Index: trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
===================================================================
--- trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 3238)
+++ trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h	(revision 3336)
@@ -75,5 +75,5 @@
     //UInt_t fNumEvents; //! Number of events written in a run
 
-    void        CheckAndWrite() const;
+    Bool_t      CheckAndWrite() const;
     Bool_t      IsFileOpen() const;
     Bool_t      GetContainer(MParList *pList);
