fixed bug with empty query filtering