Index: trunk/MagicSoft/Mars/mhist/MHMatrix.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1829)
+++ trunk/MagicSoft/Mars/mhist/MHMatrix.cc	(revision 1830)
@@ -216,9 +216,7 @@
     fM.ResizeTo(fM.GetNrows()*2, fData->GetNumEntries());
 
-    for (int x=0; x<m.GetNcols(); x++)
-    {
-        TVector vold(fM.GetNcols());
-        TMatrixColumn(fM, x) = vold = TMatrixColumn(m, x);
-    }
+    TVector vold(fM.GetNcols());
+    for (int x=0; x<m.GetNrows(); x++)
+        TMatrixRow(fM, x) = vold = TMatrixRow(m, x);
 }
 
@@ -254,9 +252,7 @@
     fM.ResizeTo(fNumRow, fData->GetNumEntries());
 
-    for (int x=0; x<fM.GetNcols(); x++)
-    {
-        TVector vold(fM.GetNcols());
-        TMatrixColumn(fM, x) = vold = TMatrixColumn(m, x);
-    }
+    TVector vold(fM.GetNcols());
+    for (int x=0; x<fM.GetNrows(); x++)
+        TMatrixRow(fM, x) = vold = TMatrixRow(m, x);
 
     return kTRUE;
@@ -597,5 +593,5 @@
     for (int i=0; i<n; i++)
     {
-        TVector vold(n);
+        TVector vold(fM.GetNcols());
         TMatrixRow(m, i) = vold = TMatrixRow(fM, idx[i]);
     }
