Fixed a query issue