std::string d2;
    gdcmTS * ts = gdcmGlobal::GetTS();
    
+   std::cout << "------------- using tagHt ----------------------------" << std::endl;
+   
    for (TagElValueHT::iterator tag = tagHt.begin();
           tag != tagHt.end();
           ++tag){
       os << std::endl;
    }
    
-   std::cout << "----------------------------------------------" << std::endl;
+   std::cout << "------------ using listElem -----------------" << std::endl;
    
    //for (ListTag::iterator i = listElem.begin();
    
       d2 = _CreateCleanString(v);  // replace non printable characters by '.'
       //os << std::hex <<g << "|" << e << std::dec << ": ";
       os << tag << " : ";
-      os << " lgr : " << (*i)->GetLength();
+      os << " lgr : " << (*i)->GetReadLength();
       os << ", Offset : " << o;
       os << " x(" << std::hex << o << std::dec << ") ";
       os << "\t[" << (*i)->GetVR()    << "]";
          }
       }              
       os << std::endl;
-
-   }
-          
+   }      
 } 
 
 /**
    else
       lgr = l;    
    tagHt[key]->SetLength(lgr); 
-
-       
-
    return 1;
 }
 
 
 /**
  * \ingroup gdcmElValSet
- * \brief   
- * @param   type
- * @param   _fp 
+ * \brief   writes on disc according to the requested format
+ * \        (ACR-NEMA, DICOM, RAW) the image
+ * \ warning does NOT add the missing elements in the header :
+ * \         it's up to the user doing it !
+ * \         (function CheckHeaderCoherence to be written)
+ * @param   type type of the File to be written 
+ *          (ACR-NEMA, DICOM, RAW)
+ * @param   _fp already open file pointer
  * @return  
  */
 void gdcmElValSet::WriteElements(FileType type, FILE * _fp) {
    guint16 val_uint16;
    
    std::vector<std::string> tokens;
+   
+   // TODO : use listElem to iterate, not TagHt!
+   //        pb : gdcmElValSet.Add does NOT update listElem
+   //        find a trick in STL to do it, at low cost !
 
    void *ptr;
 
 
-// $Header: /cvs/public/gdcm/src/Attic/gdcmElValue.h,v 1.8 2003/10/09 13:22:54 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmElValue.h,v 1.9 2003/11/10 14:17:12 jpr Exp $
 
 #ifndef GDCMELVALUE_H
 #define GDCMELVALUE_H
 class GDCM_EXPORT gdcmElValue {
 private:
    gdcmDictEntry *entry;
-   guint32 LgrElem;
+   guint32 UsableLength;  // Updated from ReadLength, by FixFoungLentgh()
+                          // for fixing a bug in the header or helping
+                         // the parser going on 
+                         
+   guint32 ReadLength;    // Length actually read on disk
+                          // (before FixFoundLength)
+                         // ReadLength will be updated only when
+                         // FixFoundLength actually fixes a bug in the header,
+                         // not when it performs a trick to help the Parser
+                         // going on.
+                         // *for internal* use only
+       
    bool ImplicitVr;       // Even when reading explicit vr files, some
                          // elements happen to be implicit. Flag them here
                          // since we can't use the entry->vr without breaking
                          // the underlying dictionary.
+                         
    void SetOffset(size_t of){ Offset = of; };
    // FIXME: In fact we should be more specific and use :
    //friend gdcmElValue * gdcmHeader::ReadNextElement(void);
        
    gdcmDictEntry * GetDictEntry(void) { return entry;    };
    
-   guint16      GetGroup(void)    { return entry->GetGroup();  };
-   guint16      GetElement(void)  { return entry->GetElement();};
-   std::string  GetKey(void)      { return entry->GetKey();    };
-   std::string  GetName(void)     { return entry->GetName();   };
-   std::string  GetVR(void)       { return entry->GetVR();     };
-   std::string  GetValue(void)    { return value;              };
-   void *       GetVoidArea(void) { return voidArea;           };
-   size_t       GetOffset(void)   { return Offset;             };   
-   guint32      GetLength(void)   { return LgrElem;            };
+   guint16      GetGroup(void)     { return entry->GetGroup();  };
+   guint16      GetElement(void)   { return entry->GetElement();};
+   std::string  GetKey(void)       { return entry->GetKey();    };
+   std::string  GetName(void)      { return entry->GetName();   };
+   std::string  GetVR(void)        { return entry->GetVR();     };
+   std::string  GetValue(void)     { return value;              };
+   void *       GetVoidArea(void)  { return voidArea;           };
+   size_t       GetOffset(void)    { return Offset;             };   
+   guint32      GetLength(void)    { return UsableLength;       };
+   // for internal use only!
+   guint32      GetReadLength(void){ return ReadLength;         };
    
-   void         SetVR(std::string v)     { entry->SetVR(v);   }; 
-   void         SetLength(guint32 l)     { LgrElem = l;       };       
-   void         SetValue(std::string val){ value = val;       };
-   void         SetVoidArea(void * area) { voidArea = area;   };       
-
+   void         SetVR(std::string v)      { entry->SetVR(v);          };    
+   void         SetLength(guint32 l)      { ReadLength=UsableLength=l;};   
+   // The following 2 members, for internal use only ! 
+   void         SetReadLength(guint32 l)  { ReadLength = l;           };       
+   void         SetUsableLength(guint32 l){ UsableLength = l;         };       
+       
+   void         SetValue(std::string val) { value = val;       };
+   void         SetVoidArea(void * area)  { voidArea = area;   };      
+ 
 };
 
 #endif
 
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.112 2003/11/10 09:21:40 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.113 2003/11/10 14:17:12 jpr Exp $
 
 #include "gdcmHeader.h"
 
  *          applying this heuristic.
  */
 void gdcmHeader::FixFoundLength(gdcmElValue * ElVal, guint32 FoundLength) {
+
+   ElVal->SetReadLength(FoundLength); // will be updated only if a bug is found
+   
    if ( FoundLength == 0xffffffff)
       FoundLength = 0;
       
    else if (FoundLength == 13) {
       // The following 'if' will be removed when there is no more
       // images on Creatis HDs with a 13 length for Manufacturer...
-      if ( (ElVal->GetGroup() != 0x0008) || (ElVal->GetElement() != 0x0070)) {
+      if ( (ElVal->GetGroup() != 0x0008) &&  
+           ( (ElVal->GetElement() != 0x0070) || (ElVal->GetElement() != 0x0080) ) ) {
       // end of remove area
          FoundLength =10;
+        ElVal->SetReadLength(10); // a bug is to be fixed
       }
    } 
      // to fix some garbage 'Leonardo' Siemens images
    else if ( (ElVal->GetGroup() == 0x0009) 
        &&
        ( (ElVal->GetElement() == 0x1113) || (ElVal->GetElement() == 0x1114) ) ){
-        FoundLength =4; 
+        FoundLength =4;
+       ElVal->SetReadLength(4); // a bug is to be fixed 
    } 
      // end of fix
         
          FoundLength =0;            
     }
                  
-   ElVal->SetLength(FoundLength);
+   ElVal->SetUsableLength(FoundLength);
 }
 
 /**
             return;
          }
          FixFoundLength(ElVal, length32); 
-
          return;
       }
 
       //   appear when we find the first group with big endian encoding. This
       //   is easy to detect since the length of a "Group Length" tag (the
       //   ones with zero as element number) has to be of 4 (0x0004). When we
-      //   encouter 1024 (0x0400) chances are the encoding changed and we
+      //   encounter 1024 (0x0400) chances are the encoding changed and we
       //   found a group with big endian encoding.
       // We shall use this second strategy. In order to make sure that we
       // can interpret the presence of an apparently big endian encoded
    // not coexist in a Data Set and Data Sets nested within it".]
    // Length is on 4 bytes.
    FixFoundLength(ElVal, ReadInt32());
+   return;
 }
 
 /**
    NewElVal = NewElValueByNumber(g, n);
    FindVR(NewElVal);
    FindLength(NewElVal);
+       
    if (errno == 1) {
       // Call it quits
       return (gdcmElValue *)0;
    rewind(fp);
    
    // We don't use any longer the HashTable, since a lot a stuff is missing
-   // we SeQuences were encountered 
+   // when SeQuences were encountered 
    //  
    //TagElValueHT ht = PubElValSet.GetTagHt();
    //for (TagElValueHT::iterator tag = ht.begin(); tag != ht.end(); ++tag) {