Fixed an infinite loop.