patch for working with OR and AND queries

this a small fix when adding  a filter