Fixed infinite loop when folding some quotients.