Protect against infinite loops.