Fix infinite loop introduced by e68493ff35e