Fixes a crash on filtering
Add new test case