fix some mpi bugs