Fix infinite loop when used incorrectly.