Fixed infinite loop.