AVALANCHE: Repair exit condition of the main loop.