Fixed some broken queries.