Fix for infinite loop.