Fix an infinite loop