This fixes the infinite loop pruning issues