Fix some broken queries.