added null handling on query filter