Relocated cia freemem out of the MPI loop.