Fixed bug in query.