by_trials not actually works when y=None