Fixed thread_mpi distribution issues.