Fix excessive iteration/recursion.