Fixes bug in filter selection
Adds more tests