Fixing infinite loop.