properly use Query instances instead of SQL hacks
remove this XXX comment which is no longer true