fix MPI finish bug, cleanup