add autostop detection