Fixed inversion of query.