Fix bug with MPI when values were not accumulated properly.
Add another barrier to prevent a potential race.