Fix bug in filter, add tests
Merge pull request #145 from flsafe/fix-bug-in-filter

Fix bug in filter, add tests