add stop.at argument in gating method. close #45