Fix bug: correct broken queries.