Index: /issm/branches/trunk-larour-SLPS2020/src/c/main/issm_post.cpp
===================================================================
--- /issm/branches/trunk-larour-SLPS2020/src/c/main/issm_post.cpp	(revision 25537)
+++ /issm/branches/trunk-larour-SLPS2020/src/c/main/issm_post.cpp	(revision 25538)
@@ -234,4 +234,5 @@
 		for (int f=0;f<nfields;f++){
 			char* field=fields[f];
+			fseek(fid,0,SEEK_SET);
 			for (int j=0;j<nsteps;j++){
 				int counter=f*nsteps+j;
@@ -548,4 +549,5 @@
 		/*start reading data from the buffer directly:*/
 		for (int f=0;f<nfields;f++){
+			fseek(fid,0,SEEK_SET);
 			char* field=fields[f];
 			for (int j=0;j<nsteps;j++){
@@ -597,5 +599,5 @@
 				x=xs[counter]; 
 				allx=xNew<IssmDouble>(nsamples);
-				MPI_Gather(x, range, ISSM_MPI_PDOUBLE,allx, 1, ISSM_MPI_PDOUBLE, 0, IssmComm::GetComm());
+				MPI_Gather(x, range, ISSM_MPI_PDOUBLE,allx, range, ISSM_MPI_PDOUBLE, 0, IssmComm::GetComm());
 				/*add to results:*/
 				if(my_rank==0){
@@ -756,6 +758,6 @@
 
 		/*Deal with average in time: */
-		fseek(fid,0,SEEK_SET);
 		for (int f=0;f<nfields;f++){
+			fseek(fid,0,SEEK_SET);
 			char* field=fields[f];
 			meanxtype[f]=readdata(&doublemat, &doublematsize, &scalar, fid,field,steps[0]);
@@ -1001,6 +1003,6 @@
 
 		/*Deal with average in time: */
-		fseek(fid,0,SEEK_SET);
 		for (int f=0;f<nfields;f++){
+			fseek(fid,0,SEEK_SET);
 			char* field=fields[f];
 			meanxtype[f]=readdata(&doublemat, &doublematsize, &scalar, fid,field,steps[0]);
