1) Added a check to prevent an infinite loop.