Fix infinite loop if STP is executed.