Fixed a couple of query statements.