diff -r f601a5e30315 src/MPI_Recv.cc
--- a/src/MPI_Recv.cc	Fri Jun 05 18:17:17 2015 +0200
+++ b/src/MPI_Recv.cc	Wed Jun 10 14:21:10 2015 +0200
@@ -448,38 +448,29 @@
 int 
 recv_struct (MPI_Comm comm, octave_value &ov, int source, int mytag)
 {
-  octave_scalar_map om;
+  octave_map om;
   int n; // map.fields ();
-
-  OCTAVE_LOCAL_BUFFER(int, tanktag, 2);
-  tanktag[0] = mytag;      // t_id
-  tanktag[1] = mytag + 1;  // n
-  int tagcap = mytag + 2;
-  int ntagkey = mytag + 3; // string
-  int ctag = mytag + 4;    // cell
+  int tag = mytag + 1;
   int info;
   MPI_Status stat;
-  info = MPI_Recv (&n, 1,MPI_INT, source, tanktag[1], comm, &stat);
+  info = MPI_Recv (&n, 1,MPI_INT, source, tag++, comm, &stat);
 
   int scap;  
   for (int i = 0; i < n; i++)
     {	
       /* nkeys: foreach, get key */
       octave_value ov_string;
-      ntagkey = ntagkey + 3;
-      info = recv_class (comm, ov_string, source, ntagkey);
+
+      info = recv_class (comm, ov_string, source, tag++);
+      if (info != MPI_SUCCESS) return info;
+
       std::string key = ov_string.string_value ();
 
-      if (info != MPI_SUCCESS) return info;
-
       /* all elements on this fname */
       octave_value conts;
       
-      // Receives capacity
-      info = MPI_Recv (&scap, 1, MPI_INT, source, tagcap, comm, &stat);
-      tagcap = tagcap + 1;
-      ctag = ctag + scap;
-      info = recv_class (comm, conts, source, ctag);
+      info = recv_class (comm, conts, source, tag++);
+      if (info != MPI_SUCCESS) return info;
 
       if (! conts.is_cell ()) return MPI_ERR_UNKNOWN;
       
@@ -492,6 +483,47 @@
     }
   
   ov=om;  
+
+  return MPI_SUCCESS;
+}
+
+
+int 
+recv_scalar_struct (MPI_Comm comm, octave_value &ov, int source, int mytag)
+{
+  octave_scalar_map om;
+  int n; // map.fields ();
+
+  int tag = mytag+1;
+
+  int info;
+  MPI_Status stat;
+  info = MPI_Recv (&n, 1,MPI_INT, source, tag++, comm, &stat);
+
+  for (int i = 0; i < n; i++)
+    {	
+      /* nkeys: foreach, get key */
+      octave_value ov_string;
+      info = recv_class (comm, ov_string, source, tag++);
+      if (info != MPI_SUCCESS) return info;
+
+      std::string key = ov_string.string_value ();
+
+      octave_value conts;
+      
+      info = recv_class (comm, conts, source, tag++);
+      if (info != MPI_SUCCESS) return info;
+
+      om.assign (key, conts);
+    }
+  if (n != om.nfields ())
+    {
+      error ("MPI_Recv: inconsistent map length");
+      return MPI_ERR_UNKNOWN;
+    }
+  
+  ov=om;  
+
   return MPI_SUCCESS;
 }
 
@@ -515,6 +547,9 @@
   
   if (tstring == "struct") 
     return (recv_struct (comm, ov, source, mytag)); 
+
+  if (tstring == "scalar struct") 
+    return (recv_scalar_struct (comm, ov, source, mytag)); 
   
   if (tstring == "scalar")  
     {
@@ -694,7 +729,7 @@
       }
     else
       {
-        error ("MPI_Recv: unsupported class %s", ov.type_name ().c_str ());
+        error ("MPI_Recv: unsupported class '%s'", tstring.c_str ());
         return MPI_ERR_UNKNOWN;
       }
 }
diff -r f601a5e30315 src/MPI_Send.cc
--- a/src/MPI_Send.cc	Fri Jun 05 18:17:17 2015 +0200
+++ b/src/MPI_Send.cc	Wed Jun 10 14:21:10 2015 +0200
@@ -566,33 +566,24 @@
 {        /* we store nkeys, */
   int n = map.nfields (); 
   int info;
-  OCTAVE_LOCAL_BUFFER(int,tanktag,2);
-  tanktag[0] = mytag; //t-id
-  tanktag[1] = mytag + 1; // n
-  int tagcap = mytag + 2;
-  int ntagkey = mytag + 3; // string
-
+  int tag;
   // struct array dimensions (ND)
   // each key stores ND field-values
   dim_vector struc_dims = map.dims ();    
   dim_vector conts_dims;         
 
   // Now we start the big loop
-  const octave_idx_type *rankrec_ptr = rankrec.fortran_vec ();
   for (octave_idx_type i = 0; i < rankrec.nelem (); i++)
     {
-      info = MPI_Send (&t_id, 1, MPI_INT, rankrec_ptr[i], 
-                       tanktag[0], comm);
+      tag = mytag;
+
+      info = MPI_Send (&t_id, 1, MPI_INT, rankrec(i), tag++, comm);
       if (info != MPI_SUCCESS) 
         return info;
-      info = MPI_Send (&n, 1, MPI_INT, rankrec_ptr[i], 
-                       tanktag[1], comm);
+      info = MPI_Send (&n, 1, MPI_INT, rankrec(i), tag++, comm);
       if (info != MPI_SUCCESS) 
         return info;
 
-      // This is to avoid confusion between tags of strings and tags of Cells
-      int   ntagCell = ntagkey + 1;
-
       // iterate through keys(fnames)
       int scap;
       for (octave_map::const_iterator p = map.begin (); p != map.end (); p++)
@@ -612,20 +603,73 @@
               return (MPI_ERR_UNKNOWN);
             }
 
-          // Sending capacity of octave_cell
-          scap = conts.capacity (); 
-          info = MPI_Send 
-            (&scap, 1, MPI_INT, rankrec_ptr[i], tagcap, comm);
-          if (info != MPI_SUCCESS) return info;
-          
-          tagcap = tagcap + 1;
-          ntagkey = ntagkey + 3;
-          info = send_class (comm, key, rankrec, ntagkey);
+          // Array with only the i-th elevement of rankrec
+          Array<int> rankrec2 = Array<int>(dim_vector(1,1));
+          rankrec2(0) = rankrec(i);
+
+          info = send_class (comm, key, rankrec2, tag++);
           if (info != MPI_SUCCESS) return info;
           
           // Sending Cell
-          ntagCell = ntagCell + conts.capacity();
-          info = send_class (comm, conts, rankrec, ntagCell);
+          info = send_class (comm, conts, rankrec2, tag++);
+          if (info != MPI_SUCCESS) return info;
+        }
+
+
+      // Alex: why would we check this as n is initialized to be map.nfields
+      // can it change somewhere?
+      if (n != map.nfields ()) 
+        {
+          error ("MPI_Send: inconsistent map length\n"); 
+          return (MPI_ERR_UNKNOWN);
+        }
+    }
+
+  return (info);
+}
+
+
+int
+send_scalar_struct (int t_id, MPI_Comm comm, octave_scalar_map map, 
+             const Array<octave_idx_type> &rankrec, int mytag)
+{        /* we store nkeys, */
+  int n = map.nfields (); 
+  int info;
+  int tag;
+
+  // Now we start the big loop
+
+  for (octave_idx_type i = 0; i < rankrec.nelem (); i++)
+    {
+      tag = mytag;
+
+      info = MPI_Send (&t_id, 1, MPI_INT, rankrec(i), 
+                       tag++, comm);
+      if (info != MPI_SUCCESS) 
+        return info;
+      info = MPI_Send (&n, 1, MPI_INT, rankrec(i), 
+                       tag++, comm);
+      if (info != MPI_SUCCESS) 
+        return info;
+
+      // iterate through keys(fnames)
+      int scap;
+      for (octave_scalar_map::const_iterator p = map.begin (); p != map.end (); p++)
+        {
+          // field name
+          std::string key = map.key (p);
+
+          // contents
+          octave_value conts = map.contents (p);    
+          
+          // Array with only the i-th elevement of rankrec
+          Array<int> rankrec2 = Array<int>(dim_vector(1,1));
+          rankrec2(0) = rankrec(i);
+
+          info = send_class (comm, key, rankrec2, tag++);
+          if (info != MPI_SUCCESS) return info;
+          
+          info = send_class (comm, conts, rankrec2, tag++);
           if (info != MPI_SUCCESS) return info;
         }
 
@@ -635,9 +679,11 @@
           return (MPI_ERR_UNKNOWN);
         }
     }
+
   return (info);
 }
 
+
 int
 send_class (MPI_Comm comm, const octave_value &ov, 
             const Array<octave_idx_type> &rankrec, 
@@ -765,6 +811,9 @@
   else if (mystring == "struct")
     return (send_struct (t_id, comm, ov.map_value (), rankrec, mytag));
 
+  else if (mystring == "scalar struct") 
+    return (send_scalar_struct (t_id, comm, ov.scalar_map_value (), rankrec, mytag));
+  
   else if (mystring == "cell")
     return (send_cell (t_id, comm, ov.cell_value (), rankrec, mytag));
       
