Fix queries that exceed the size of the container.