Fix bug with filtering