fix memory usage when passing through filter