Index: /trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11541)
+++ /trunk/FACT++/src/EventBuilderWrapper.h	(revision 11542)
@@ -306,5 +306,6 @@
         {
             ostringstream str;
-            str << "ofstream::write() failed for '" << name << "': " << strerror(errno) << " [errno=" << errno << "]";
+
+            str << "ofstream::write() failed for '" << GetFileName() << "': " << strerror(errno) << " [errno=" << errno << "]";
             Error(str);
 
@@ -317,5 +318,5 @@
         {
             ostringstream str;
-            str << "ofstream::close() failed for '" << name << "': " << strerror(errno) << " [errno=" << errno << "]";
+            str << "ofstream::close() failed for '" << GetFileName() << "': " << strerror(errno) << " [errno=" << errno << "]";
             Error(str);
 
@@ -544,7 +545,7 @@
 
             // Header values whihc won't change during the run
-            WriteKey("BOARDID", i, hh.board_id,   "ID");
-            WriteKey("DNA",     i, hh.DNA,        "DNA");
-            WriteKey("FWVER",   i, hh.version_no, "Firmware Version");
+            WriteKey("ID",    i, hh.board_id,   "Board ID");
+            WriteKey("DNA",   i, hh.DNA,        "DNA");
+            WriteKey("FWVER", i, hh.version_no, "Firmware Version");
         }
 
@@ -1578,9 +1579,9 @@
             }
 
-            if (*val<*min)
-                min = val;
-
-            if (*val>*max)
-                max = val;
+            if (*ref<*min)
+                min = ref;
+
+            if (*ref>*max)
+                max = ref;
 
             if (*val!=*ref)
@@ -1706,4 +1707,5 @@
         if (old.fStatus != h.fStatus || changed)
         {
+            cout << "Send" << endl;
             const array<uint16_t,42> sts = CompareBits(&h, &h.fStatus);
             Update(fDimStatus, sts);
@@ -1741,5 +1743,5 @@
             data.insert(data.end(), tmp[0].data(), tmp[0].data()+40);   // val: 42-81
 
-            for (int j=0; j<=3; j++)
+            for (int j=1; j<=3; j++)
             {
                 const array<int16_t,42> &ref = tmp[j];
@@ -1750,8 +1752,8 @@
 
                 // Global max
-                if (ref[41]>data[40])          // 41=max
-                    data[40] = ref[41];
-
-                for (int i=0; i<40; i++)       
+                if (ref[41]>data[41])          // 41=max
+                    data[41] = ref[41];
+
+                for (int i=0; i<40; i++)
                 {
                     // min per board
@@ -1763,5 +1765,7 @@
                         data[i+42] = ref[i];   // ref:   0-39
                 }
-            }
+
+
+           }
 
             vector<float> deg(82);              //  0: global min,  1-40: min
