Fixes a memory leak and a potential exception when filtering fails