Fixed a bug where MPI_T_ERR_INVALID_INDEX was not being checked