Improved query filter handling.