Bug fix in chain loop.