Fix a bug in GLM grid search