More improvements in the query builder for a correct behaviour.