Fix an eternal loop in the iteration process.