query filtering fixes