fixed MPI wait bug