Fix an oversight in the algorithm