bug in querying