diff --git a/fourier_transform.c b/fourier_transform.c
index 7bf1c30459282b46e451ba8481a7af3491f744ca..088889c30b68f4d06115e5b24e4a6d9ede118252 100755
--- a/fourier_transform.c
+++ b/fourier_transform.c
@@ -254,12 +254,12 @@ void write_fftw_data(){
 
   if(rank == 0)printf("WRITING IMAGE\n");
 
- #ifdef FITSIO
+#ifdef FITSIO
   uint * fpixel = (uint *) malloc(sizeof(uint)*naxis);
   uint * lpixel = (uint *) malloc(sizeof(uint)*naxis);
- #endif
+#endif
 
- #ifdef FITSIO
+#ifdef FITSIO
 
   fpixel[0] = 1;
   fpixel[1] = rank*yaxis+1;
@@ -276,57 +276,26 @@ void write_fftw_data(){
   fits_write_subset(fptrimg, TDOUBLE, fpixel, lpixel, image_imag, &status);
   fits_close_file(fptrimg, &status);
 
- #endif //FITSIO
-
-  for (int isector=0; isector<size; isector++)
-    {
-
-      MPI_Barrier(MPI_COMM_WORLD);
-      
-      if(isector == rank)
-	{
-
-	  printf("%d writing\n",isector);
+#endif //FITSIO
 
-	 #ifdef FITSIO
+  file.pFilereal = fopen (out.fftfile2,"wb");
+  file.pFileimg = fopen (out.fftfile3,"wb");
 
-	  fpixel[0] = 1;
-	  fpixel[1] = isector*yaxis+1;
-	  lpixel[0] = xaxis;
-	  lpixel[1] = (isector+1)*yaxis;
+  long global_index = rank*(xaxis*yaxis)*sizeof(long);
 
-	  status = 0;
-	  fits_open_image(&fptreal, testfitsreal, READWRITE, &status);
-	  fits_write_subset(fptreal, TDOUBLE, fpixel, lpixel, image_real, &status);
-	  fits_close_file(fptreal, &status);
+  fseek(file.pFilereal, global_index, SEEK_SET);
+  fwrite(image_real, xaxis*yaxis, sizeof(double), file.pFilereal);
+  fseek(file.pFileimg, global_index, SEEK_SET);
+  fwrite(image_imag, xaxis*yaxis, sizeof(double), file.pFileimg); 
 
-	  status = 0;
-	  fits_open_image(&fptrimg, testfitsimag, READWRITE, &status);
-	  fits_write_subset(fptrimg, TDOUBLE, fpixel, lpixel, image_imag, &status);
-	  fits_close_file(fptrimg, &status);
-
-	 #endif //FITSIO
-
-	  file.pFilereal = fopen (out.fftfile2,"ab");
-	  file.pFileimg = fopen (out.fftfile3,"ab");
-
-	  uint global_index = isector*(xaxis*yaxis)*sizeof(double);
-
-	  fseek(file.pFilereal, global_index, SEEK_SET);
-	  fwrite(image_real, xaxis*yaxis, sizeof(double), file.pFilereal);
-	  fseek(file.pFileimg, global_index, SEEK_SET);
-	  fwrite(image_imag, xaxis*yaxis, sizeof(double), file.pFileimg);
-
-	  fclose(file.pFilereal);
-	  fclose(file.pFileimg);
-	}
-    }
- 
+  fclose(file.pFilereal);
+  fclose(file.pFileimg);
+  
   MPI_Barrier(MPI_COMM_WORLD);
 
   timing_wt.write += CPU_TIME_wt - start_image;
 
- #endif //WRITE_IMAGE
+#endif //WRITE_IMAGE
 
- #endif  //FFTW
+#endif  //FFTW
 }