Catch infinite loops.