Fix very rare case where SAPI could hang forever