Fix up the query.