Bug fix. Infinite look on query.