Fixed an infinite loop ending in mass disaster.