Index: /trunk/FACT++/src/EventBuilder.c
===================================================================
--- /trunk/FACT++/src/EventBuilder.c	(revision 10978)
+++ /trunk/FACT++/src/EventBuilder.c	(revision 10979)
@@ -262,5 +262,5 @@
 
    
-   needmem = sizeof(EVENT) + NPIX*nRoi*2 + NTMARK*nRoi*2 - 2 ; //-2 because of dummy adc_data[1]
+   needmem = sizeof(EVENT) + NPIX*nRoi*2 + NTMARK*nRoi*2;
 
    headmem = NBOARDS* sizeof(PEVNT_HEADER) ;
Index: /trunk/FACT++/src/EventBuilderWrapper.h
===================================================================
--- /trunk/FACT++/src/EventBuilderWrapper.h	(revision 10978)
+++ /trunk/FACT++/src/EventBuilderWrapper.h	(revision 10979)
@@ -161,4 +161,5 @@
     enum
     {
+        kEndOfFile = 0,
         kIdentifier = 1,
         kRunHeader,
@@ -202,4 +203,5 @@
         }
 
+        // FIXME: Split this
         const vector<char> block(sizeof(uint32_t)+sizeof(RUN_TAIL));
         WriteBlockHeader(kRunSummary, 1, 0, block.size());
@@ -221,12 +223,14 @@
     virtual bool Write(EVENT *evt)
     {
-        const int sh = sizeof(PEVNT_HEADER)+(NPIX-1)*evt->Roi*2;
+        const int sh = sizeof(EVENT)-2 + NPIX*evt->Roi*2;
 
         WriteBlockHeader(kEvent, 1, fCounter++, sh);
-        fOut.write(reinterpret_cast<char*>(evt)+2, sh-2);
+        fOut.write(reinterpret_cast<char*>(evt)+2, sh);
         return true;
     }
     virtual bool Close(RUN_TAIL *tail= 0)
     {
+        WriteBlockHeader(kEndOfFile, 0, 0, 0);
+
         if (tail)
         {
@@ -522,5 +526,5 @@
         fNumRows++;
 
-        const int sh = sizeof(PEVNT_HEADER)+(NPIX-1)*e->Roi*2;
+        const int sh = sizeof(EVENT)+NPIX*e->Roi*2;
 
         // column size pointer
Index: /trunk/FACT++/src/FAD.h
===================================================================
--- /trunk/FACT++/src/FAD.h	(revision 10978)
+++ /trunk/FACT++/src/FAD.h	(revision 10979)
@@ -128,5 +128,5 @@
    int16_t StartTM[NTMARK]; // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled
 
-  uint16_t Adc_Data[1];     // final length defined by malloc ....
+  uint16_t Adc_Data[];     // final length defined by malloc ....
 
 } EVENT ;
