fixed issue 1268, better grid search options, thanks Paolo Angulo