Fixed  infinite loop.