Make stoppgn more robust.