Index: XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf	(revision 1249)
@@ -22,5 +22,5 @@
 /* LOCAL */
 DECLARE_ARRAY(bool, 1 , mask_1d, false)
-DECLARE_ARRAY(bool, 2 , mask_2d)
+DECLARE_ARRAY(bool, 2 , mask_2d, false)
 
 /* GLOBAL */
Index: XIOS/dev/XIOS_DEV_CMIP6/src/filter/source_filter.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/filter/source_filter.cpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/filter/source_filter.cpp	(revision 1249)
@@ -33,12 +33,13 @@
 
     packet->data.resize(grid->storeIndex_client.numElements());
-    if (compression) grid->inputField(data, packet->data) ;
-    else
-    {
-      // just make a flat copy
-      CArray<double, N> data_tmp(data.copy()) ; // supress const attribute
-      CArray<double,1> dataTmp2(data_tmp.dataFirst(),shape(data.numElements()),neverDeleteData) ;
-      packet->data = dataTmp2 ;
-    }
+    grid->inputField(data, packet->data) ;
+    // if (compression) grid->inputField(data, packet->data) ;
+    // else
+    // {
+    //   // just make a flat copy
+    //   CArray<double, N> data_tmp(data.copy()) ; // supress const attribute
+    //   CArray<double,1> dataTmp2(data_tmp.dataFirst(),shape(data.numElements()),neverDeleteData) ;
+    //   packet->data = dataTmp2 ;
+    // }
     // Convert missing values to NaN
     if (hasMissingValue)
@@ -72,6 +73,5 @@
     packet->timestamp = date;
     packet->status = CDataPacket::NO_ERROR;
-
-    // if (data.size() != grid->storeIndex_toSrv.size())
+    
     if (data.size() != grid->storeIndex_fromSrv.size())
       ERROR("CSourceFilter::streamDataFromServer(CDate date, const std::map<int, CArray<double, 1> >& data)",
@@ -82,6 +82,5 @@
     std::map<int, CArray<double, 1> >::const_iterator it, itEnd = data.end();
     for (it = data.begin(); it != itEnd; it++)
-    {
-      // CArray<int,1>& index = grid->storeIndex_toSrv[it->first];
+    {      
       CArray<int,1>& index = grid->storeIndex_fromSrv[it->first];
       for (int n = 0; n < index.numElements(); n++)
Index: XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1249)
@@ -54,4 +54,6 @@
       {
         domain->computeWrittenIndex();
+        domain->computeWrittenCompressedIndex(comm_file);
+
         if (domain->type == CDomain::type_attr::unstructured)
         {
@@ -1133,4 +1135,5 @@
 
         axis->computeWrittenIndex();
+        axis->computeWrittenCompressedIndex(comm_file);
        
         int zoom_size  = (MULTI_FILE == SuperClass::type) ? axis->zoom_n
@@ -1187,5 +1190,5 @@
 
             StdString axisBoundsId = axisid + "_bounds";
-            if (!axis->bounds.isEmpty())
+            if (!axis->bounds.isEmpty() && axis->label.isEmpty())
             {
               dims.push_back("axis_nbounds");
@@ -1488,11 +1491,13 @@
                }
 
-               indexes.resize(domain->compressedIndexToWriteOnServer.numElements());
-               indexes = domain->compressedIndexToWriteOnServer;
+               // indexes.resize(domain->compressedIndexToWriteOnServer[comm_file].numElements());
+               // indexes = domain->compressedIndexToWriteOnServer[com_file];
+               indexes.resize(domain->getCompressedIndexToWriteOnServer(comm_file).numElements());
+               indexes = domain->getCompressedIndexToWriteOnServer(comm_file);
 
                isDistributed = domain->isDistributed();
-               nbIndexes = domain->getNumberWrittenIndexes();
-               totalNbIndexes = domain->getTotalNumberWrittenIndexes();
-               offset = domain->getOffsetWrittenIndexes();
+               nbIndexes = domain->getNumberWrittenIndexes(comm_file);
+               totalNbIndexes = domain->getTotalNumberWrittenIndexes(comm_file);
+               offset = domain->getOffsetWrittenIndexes(comm_file);
                firstGlobalIndex = domain->ibegin + domain->jbegin * domain->ni_glo;
 
@@ -1514,11 +1519,14 @@
                compress = axisId;
 
-               indexes.resize(axis->compressedIndexToWriteOnServer.numElements());
-               indexes = axis->compressedIndexToWriteOnServer;
+               // indexes.resize(axis->compressedIndexToWriteOnServer.numElements());
+               // indexes = axis->compressedIndexToWriteOnServer;
+
+               indexes.resize(axis->getCompressedIndexToWriteOnServer(comm_file).numElements());
+               indexes = axis->getCompressedIndexToWriteOnServer(comm_file);
 
                isDistributed = axis->isDistributed();
-               nbIndexes = axis->getNumberWrittenIndexes();
-               totalNbIndexes = axis->getTotalNumberWrittenIndexes();
-               offset = axis->getOffsetWrittenIndexes();
+               nbIndexes = axis->getNumberWrittenIndexes(comm_file);
+               totalNbIndexes = axis->getTotalNumberWrittenIndexes(comm_file);
+               offset = axis->getOffsetWrittenIndexes(comm_file);
                firstGlobalIndex = axis->begin;
 
@@ -2291,6 +2299,6 @@
                         if (domain->isCompressible())
                         {
-                          start.push_back(domain->getOffsetWrittenIndexes());
-                          count.push_back(domain->getNumberWrittenIndexes());
+                          start.push_back(domain->getOffsetWrittenIndexes(comm_file));
+                          count.push_back(domain->getNumberWrittenIndexes(comm_file));
                           idx -= 2;
                         }
@@ -2315,6 +2323,6 @@
                         if (axis->isCompressible())
                         {
-                          start.push_back(axis->getOffsetWrittenIndexes());
-                          count.push_back(axis->getNumberWrittenIndexes());
+                          start.push_back(axis->getOffsetWrittenIndexes(comm_file));
+                          count.push_back(axis->getNumberWrittenIndexes(comm_file));
                         }
                         else
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.cpp	(revision 1249)
@@ -23,5 +23,5 @@
       , isClientAfterTransformationChecked(false)
       , hasBounds(false), isCompressible_(false)
-      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
+      , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_()
       , transformationMap_(), hasValue(false), hasLabel(false)
       , computedWrittenIndex_(false)
@@ -34,5 +34,5 @@
       , isClientAfterTransformationChecked(false)
       , hasBounds(false), isCompressible_(false)
-      , numberWrittenIndexes_(0), totalNumberWrittenIndexes_(0), offsetWrittenIndexes_(0)
+      , numberWrittenIndexes_(), totalNumberWrittenIndexes_(), offsetWrittenIndexes_()
       , transformationMap_(), hasValue(false), hasLabel(false)
       , computedWrittenIndex_(false)
@@ -107,7 +107,9 @@
      \return the number of indexes written by each server
    */
-   int CAxis::getNumberWrittenIndexes() const
-   {
-     return numberWrittenIndexes_;
+   int CAxis::getNumberWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return numberWrittenIndexes_[writtenSize];
    }
 
@@ -116,7 +118,9 @@
      \return the total number of indexes written by the servers
    */
-   int CAxis::getTotalNumberWrittenIndexes() const
-   {
-     return totalNumberWrittenIndexes_;
+   int CAxis::getTotalNumberWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return totalNumberWrittenIndexes_[writtenSize];
    }
 
@@ -125,9 +129,17 @@
      \return the offset of indexes written by each server
    */
-   int CAxis::getOffsetWrittenIndexes() const
-   {
-     return offsetWrittenIndexes_;
-   }
-
+   int CAxis::getOffsetWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return offsetWrittenIndexes_[writtenSize];
+   }
+
+   CArray<int, 1>& CAxis::getCompressedIndexToWriteOnServer(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return compressedIndexToWriteOnServer[writtenSize];
+   }
    //----------------------------------------------------------------
 
@@ -692,7 +704,77 @@
     }
 
+    // if (isCompressible())
+    // {
+    //   nbWritten = 0;
+    //   boost::unordered_map<size_t,size_t> localGlobalIndexMap;
+    //   for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+    //   {
+    //     indGlo = *itSrv;
+    //     if (ite != globalLocalIndexMap_.find(indGlo))
+    //     {
+    //       localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
+    //       ++nbWritten;
+    //     }                 
+    //   }
+
+    //   nbWritten = 0;
+    //   for (int idx = 0; idx < data_index.numElements(); ++idx)
+    //   {
+    //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+    //     {
+    //       ++nbWritten;
+    //     }
+    //   }
+
+    //   compressedIndexToWriteOnServer.resize(nbWritten);
+    //   nbWritten = 0;
+    //   for (int idx = 0; idx < data_index.numElements(); ++idx)
+    //   {
+    //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
+    //     {
+    //       compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)];
+    //       ++nbWritten;
+    //     }
+    //   }
+
+    //   numberWrittenIndexes_ = nbWritten;
+    //   if (isDistributed())
+    //   {
+             
+    //     MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+    //     MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+    //     offsetWrittenIndexes_ -= numberWrittenIndexes_;
+    //   }
+    //   else
+    //     totalNumberWrittenIndexes_ = numberWrittenIndexes_;
+    // }
+  }
+
+  void CAxis::computeWrittenCompressedIndex(MPI_Comm writtenComm)
+  {
+    int writtenCommSize;
+    MPI_Comm_size(writtenComm, &writtenCommSize);
+    if (compressedIndexToWriteOnServer.find(writtenCommSize) != compressedIndexToWriteOnServer.end())
+      return;
+
     if (isCompressible())
     {
-      nbWritten = 0;
+      size_t nbWritten = 0, indGlo;
+      CContext* context=CContext::getCurrent();      
+      CContextServer* server = context->server; 
+
+      // We describe the distribution of client (server) on which data are written
+      std::vector<int> nBegin(1), nSize(1), nBeginGlobal(1), nGlob(1);
+      nBegin[0]       = zoom_begin;
+      nSize[0]        = zoom_n;   
+      nBeginGlobal[0] = 0; 
+      nGlob[0]        = n_glo;
+      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 
+      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex();
+      boost::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(),
+                                                          ite = globalLocalIndexMap_.end(), it;   
+
+      CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(),
+                                       itSrve = writtenGlobalIndex.end(), itSrv;
       boost::unordered_map<size_t,size_t> localGlobalIndexMap;
       for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
@@ -715,5 +797,5 @@
       }
 
-      compressedIndexToWriteOnServer.resize(nbWritten);
+      compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten);
       nbWritten = 0;
       for (int idx = 0; idx < data_index.numElements(); ++idx)
@@ -721,22 +803,21 @@
         if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_index(idx)))
         {
-          compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_index(idx)];
+          compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_index(idx)];
           ++nbWritten;
         }
       }
 
-      numberWrittenIndexes_ = nbWritten;
+      numberWrittenIndexes_[writtenCommSize] = nbWritten;
       if (isDistributed())
       {
              
-        MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-        MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-        offsetWrittenIndexes_ -= numberWrittenIndexes_;
+        MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
+        MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
+        offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize];
       }
       else
-        totalNumberWrittenIndexes_ = numberWrittenIndexes_;
-    }
-  }
-
+        totalNumberWrittenIndexes_[writtenCommSize] = numberWrittenIndexes_[writtenCommSize];
+    }
+  }
 
   /*!
@@ -853,5 +934,5 @@
     if (zoom_n<=0)
     {
-      zoom_begin = 0; zoom_n = 0;
+      zoom_n = 0; zoom_begin=global_zoom_begin; //0; zoom_begin = 0; 
     }
 
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/axis.hpp	(revision 1249)
@@ -69,7 +69,8 @@
          const std::set<StdString> & getRelFiles(void) const;
 
-         int getNumberWrittenIndexes() const;
-         int getTotalNumberWrittenIndexes() const;
-         int getOffsetWrittenIndexes() const;
+         int getNumberWrittenIndexes(MPI_Comm writtenCom);
+         int getTotalNumberWrittenIndexes(MPI_Comm writtenCom);
+         int getOffsetWrittenIndexes(MPI_Comm writtenCom);
+         CArray<int, 1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom);
 
          std::map<int, StdSize> getAttributesBufferSize(CContextClient* client);
@@ -110,4 +111,5 @@
 
          void computeWrittenIndex();
+         void computeWrittenCompressedIndex(MPI_Comm);
          bool hasTransformation();
          void solveInheritanceTransformation();
@@ -120,6 +122,5 @@
       public: 
         bool hasValue;        
-        CArray<size_t,1> localIndexToWriteOnServer;
-        CArray<int, 1> compressedIndexToWriteOnServer;
+        CArray<size_t,1> localIndexToWriteOnServer;        
 
       private:
@@ -161,5 +162,6 @@
          boost::unordered_map<size_t,size_t> globalLocalIndexMap_;
          std::vector<int> indexesToWrite;
-         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
+         std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
+         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer;
          std::map<CContextClient*, std::vector<int> > connectedServerRank_;         
          bool hasBounds;
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.cpp	(revision 1249)
@@ -86,7 +86,9 @@
      \return the number of indexes written by each server
    */
-   int CDomain::getNumberWrittenIndexes() const
-   {
-     return numberWrittenIndexes_;
+   int CDomain::getNumberWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return numberWrittenIndexes_[writtenSize];
    }
 
@@ -95,7 +97,9 @@
      \return the total number of indexes written by the servers
    */
-   int CDomain::getTotalNumberWrittenIndexes() const
-   {
-     return totalNumberWrittenIndexes_;
+   int CDomain::getTotalNumberWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return totalNumberWrittenIndexes_[writtenSize];
    }
 
@@ -104,7 +108,16 @@
      \return the offset of indexes written by each server
    */
-   int CDomain::getOffsetWrittenIndexes() const
-   {
-     return offsetWrittenIndexes_;
+   int CDomain::getOffsetWrittenIndexes(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return offsetWrittenIndexes_[writtenSize];
+   }
+
+   CArray<int, 1>& CDomain::getCompressedIndexToWriteOnServer(MPI_Comm writtenCom)
+   {
+     int writtenSize;
+     MPI_Comm_size(writtenCom, &writtenSize);
+     return compressedIndexToWriteOnServer[writtenSize];
    }
 
@@ -1497,7 +1510,7 @@
    void CDomain::checkArea(void)
    {
-     bool hasAreaValue = (0 != areavalue.numElements());
-     hasArea = !area.isEmpty() || !areavalue.isEmpty();
-     if (hasArea)
+     bool hasAreaValue = (!areavalue.isEmpty() && 0 != areavalue.numElements());
+     hasArea = !area.isEmpty();
+     if (hasArea && !hasAreaValue)
      {
        if (area.extent(0) != ni || area.extent(1) != nj)
@@ -1902,49 +1915,118 @@
       }
       
-      if (isCompressible())
-      {
-        nbWritten = 0;
-        boost::unordered_map<size_t,size_t> localGlobalIndexMap;
-        for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
-        {
-          indGlo = *itSrv;
-          if (ite != globalLocalIndexMap_.find(indGlo))
-          {
-            localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
-            ++nbWritten;
-          }                 
-        }
-
-        nbWritten = 0;
-        for (int idx = 0; idx < data_i_index.numElements(); ++idx)
-        {
-          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
-          {
-            ++nbWritten;
-          }
-        }
-
-        compressedIndexToWriteOnServer.resize(nbWritten);
-        nbWritten = 0;
-        for (int idx = 0; idx < data_i_index.numElements(); ++idx)
-        {
-          if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
-          {
-            compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)];
-            ++nbWritten;
-          }
-        }
-
-        numberWrittenIndexes_ = nbWritten;
-        if (isDistributed())
-        {            
-          MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-          MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
-          offsetWrittenIndexes_ -= numberWrittenIndexes_;
-        }
-        else
-          totalNumberWrittenIndexes_ = numberWrittenIndexes_;
-      }      
-   }
+      // if (isCompressible())
+      // {
+      //   nbWritten = 0;
+      //   boost::unordered_map<size_t,size_t> localGlobalIndexMap;
+      //   for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+      //   {
+      //     indGlo = *itSrv;
+      //     if (ite != globalLocalIndexMap_.find(indGlo))
+      //     {
+      //       localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
+      //       ++nbWritten;
+      //     }                 
+      //   }
+
+      //   nbWritten = 0;
+      //   for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+      //   {
+      //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+      //     {
+      //       ++nbWritten;
+      //     }
+      //   }
+
+      //   compressedIndexToWriteOnServer.resize(nbWritten);
+      //   nbWritten = 0;
+      //   for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+      //   {
+      //     if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+      //     {
+      //       compressedIndexToWriteOnServer(nbWritten) = localGlobalIndexMap[data_i_index(idx)];
+      //       ++nbWritten;
+      //     }
+      //   }
+
+      //   numberWrittenIndexes_ = nbWritten;
+      //   if (isDistributed())
+      //   {            
+      //     MPI_Allreduce(&numberWrittenIndexes_, &totalNumberWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      //     MPI_Scan(&numberWrittenIndexes_, &offsetWrittenIndexes_, 1, MPI_INT, MPI_SUM, server->intraComm);
+      //     offsetWrittenIndexes_ -= numberWrittenIndexes_;
+      //   }
+      //   else
+      //     totalNumberWrittenIndexes_ = numberWrittenIndexes_;
+      // }      
+   }
+
+  void CDomain::computeWrittenCompressedIndex(MPI_Comm writtenComm)
+  {
+    int writtenCommSize;
+    MPI_Comm_size(writtenComm, &writtenCommSize);
+    if (compressedIndexToWriteOnServer.find(writtenCommSize) != compressedIndexToWriteOnServer.end())
+      return;
+
+    if (isCompressible())
+    {
+      size_t nbWritten = 0, indGlo;
+      CContext* context=CContext::getCurrent();      
+      CContextServer* server = context->server;  
+
+      std::vector<int> nBegin(2), nSize(2), nBeginGlobal(2), nGlob(2);
+      nBegin[0]       = zoom_ibegin;  nBegin[1] = zoom_jbegin;
+      nSize[0]        = zoom_ni;      nSize[1]  = zoom_nj;
+      nBeginGlobal[0] = 0; nBeginGlobal[1] = 0;
+      nGlob[0]        = ni_glo;   nGlob[1] = nj_glo;
+      CDistributionServer srvDist(server->intraCommSize, nBegin, nSize, nBeginGlobal, nGlob); 
+      const CArray<size_t,1>& writtenGlobalIndex  = srvDist.getGlobalIndex();
+
+      boost::unordered_map<size_t,size_t>::const_iterator itb = globalLocalIndexMap_.begin(),
+                                                          ite = globalLocalIndexMap_.end(), it;   
+      CArray<size_t,1>::const_iterator itSrvb = writtenGlobalIndex.begin(),
+                                       itSrve = writtenGlobalIndex.end(), itSrv;
+      boost::unordered_map<size_t,size_t> localGlobalIndexMap;
+      for (itSrv = itSrvb; itSrv != itSrve; ++itSrv)
+      {
+        indGlo = *itSrv;
+        if (ite != globalLocalIndexMap_.find(indGlo))
+        {
+          localGlobalIndexMap[localIndexToWriteOnServer(nbWritten)] = indGlo;
+          ++nbWritten;
+        }                 
+      }
+
+      nbWritten = 0;
+      for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+      {
+        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+        {
+          ++nbWritten;
+        }
+      }
+
+      compressedIndexToWriteOnServer[writtenCommSize].resize(nbWritten);
+      nbWritten = 0;
+      for (int idx = 0; idx < data_i_index.numElements(); ++idx)
+      {
+        if (localGlobalIndexMap.end() != localGlobalIndexMap.find(data_i_index(idx)))
+        {
+          compressedIndexToWriteOnServer[writtenCommSize](nbWritten) = localGlobalIndexMap[data_i_index(idx)];
+          ++nbWritten;
+        }
+      }
+
+      numberWrittenIndexes_[writtenCommSize] = nbWritten;
+      if (isDistributed())
+      {
+             
+        MPI_Allreduce(&numberWrittenIndexes_[writtenCommSize], &totalNumberWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
+        MPI_Scan(&numberWrittenIndexes_[writtenCommSize], &offsetWrittenIndexes_[writtenCommSize], 1, MPI_INT, MPI_SUM, writtenComm);
+        offsetWrittenIndexes_[writtenCommSize] -= numberWrittenIndexes_[writtenCommSize];
+      }
+      else
+        totalNumberWrittenIndexes_[writtenCommSize] = numberWrittenIndexes_[writtenCommSize];
+      }
+  }
 
   /*!
@@ -2406,5 +2488,5 @@
   void CDomain::recvIndex(std::map<int, CBufferIn*>& rankBuffers)
   {
-    int nbReceived = rankBuffers.size(), i, ind, index, type_int;
+    int nbReceived = rankBuffers.size(), i, ind, index, type_int, iIndex, jIndex;
     recvClientRanks_.resize(nbReceived);        
 
@@ -2426,5 +2508,7 @@
     globalLocalIndexMap_.rehash(std::ceil(nbIndGlob/globalLocalIndexMap_.max_load_factor()));
     i_index.resize(nbIndGlob);
-    j_index.resize(nbIndGlob);    
+    j_index.resize(nbIndGlob);   
+    int nbIndexGlobMax = nbIndGlob, nbIndLoc;
+
     nbIndGlob = 0;
     for (i = 0; i < nbReceived; ++i)
@@ -2436,8 +2520,20 @@
          if (0 == globalLocalIndexMap_.count(index))
          {
-           i_index(nbIndGlob) = index % ni_glo;
-           j_index(nbIndGlob) = index / ni_glo;
-           globalLocalIndexMap_[index] = nbIndGlob;  
-           ++nbIndGlob;
+           iIndex = (index%ni_glo)-ibegin;
+           iIndex = (iIndex < 0) ? 0 : iIndex;
+           jIndex = (index/ni_glo)-jbegin;
+           jIndex = (jIndex < 0) ? 0 : jIndex;
+           nbIndLoc = iIndex + ni * jIndex;
+           if (nbIndLoc < nbIndexGlobMax)
+           {
+             i_index(nbIndLoc) = index % ni_glo;
+             j_index(nbIndLoc) = index / ni_glo;
+             globalLocalIndexMap_[index] = nbIndLoc;  
+             ++nbIndGlob;
+           }
+           // i_index(nbIndGlob) = index % ni_glo;
+           // j_index(nbIndGlob) = index / ni_glo;
+           // globalLocalIndexMap_[index] = nbIndGlob;  
+           // ++nbIndGlob;
          } 
       } 
@@ -2497,6 +2593,6 @@
     if (zoom_ni<=0 || zoom_nj<=0)
     {
-      zoom_ibegin=0 ; zoom_iend=0 ; zoom_ni=0 ;
-      zoom_jbegin=0 ; zoom_jend=0 ; zoom_nj=0 ;
+      zoom_ni=0 ; zoom_ibegin=global_zoom_ibegin ; //=0; zoom_iend=0 ; 
+      zoom_nj=0 ; zoom_jbegin=global_zoom_jbegin ; //=0; zoom_jend=0 ;
     }
 
@@ -2555,4 +2651,5 @@
     nbMaskInd = globalLocalIndexMap_.size();
     mask_1d.resize(nbMaskInd);
+    mask_1d = false;
     
     for (i = 0; i < nbReceived; ++i)
@@ -2862,5 +2959,8 @@
     Receive data index information from client(s)
     A client receives data index from different clients to rebuild its own data index.
+    Because we use global index + mask info to calculate the sending data to client(s), 
+    this data index must be updated with mask info (maybe it will change in the future)
     Because the data index is local, to rebuild data index of received client, we should use global index along with. 
+
     \param[in] rankBuffers rank of sending client and the corresponding receive buffer     
   */
@@ -2901,5 +3001,10 @@
          lInd = globalLocalIndexMap_[size_t(tmpInd(ind))];
          dataIIndex(lInd) = (-1 == dataIIndex(lInd)) ? tmpI(ind) : dataIIndex(lInd); // Only fill in dataIndex if there is no data
-         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);         
+         dataJIndex(lInd) = (-1 == dataJIndex(lInd)) ? tmpJ(ind) : dataJIndex(lInd);  
+
+         if (!mask_1d(lInd))   // Include mask info into data index on the RECEIVE getServerDimensionSizes    
+         {
+           dataIIndex(lInd) = dataJIndex(lInd) = -1;
+         }
       } 
     }
Index: XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.hpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.hpp	(revision 1248)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/node/domain.hpp	(revision 1249)
@@ -92,7 +92,8 @@
          bool isWrittenCompressed(const StdString& filename) const;
          
-         int getNumberWrittenIndexes() const;
-         int getTotalNumberWrittenIndexes() const;
-         int getOffsetWrittenIndexes() const;
+         int getNumberWrittenIndexes(MPI_Comm writtenCom);
+         int getTotalNumberWrittenIndexes(MPI_Comm writtenCom);
+         int getOffsetWrittenIndexes(MPI_Comm writtenCom);
+         CArray<int,1>& getCompressedIndexToWriteOnServer(MPI_Comm writtenCom);
 
          std::map<int, StdSize> getAttributesBufferSize(CContextClient* client);
@@ -113,4 +114,5 @@
          
          void computeWrittenIndex();
+         void computeWrittenCompressedIndex(MPI_Comm);
 
          void AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat,
@@ -138,6 +140,5 @@
          CArray<double, 1> areavalue;
 
-         CArray<size_t,1> localIndexToWriteOnServer;
-         CArray<int, 1> compressedIndexToWriteOnServer;
+         CArray<size_t,1> localIndexToWriteOnServer;         
 
          CArray<bool, 1> localMask;
@@ -209,5 +210,6 @@
          std::vector<int> indexesToWrite;
          std::vector<int> recvClientRanks_;
-         int numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;         
+         std::map<int,int> numberWrittenIndexes_, totalNumberWrittenIndexes_, offsetWrittenIndexes_;
+         std::map<int, CArray<int, 1> > compressedIndexToWriteOnServer;     
          std::map<CContextClient*, std::map<int,size_t> > connectedDataSize_;
          std::map<CContextClient*, std::vector<int> > connectedServerRank_;
