Fix failures in grid search.