Fix nested through filters. Fixes #2565.

See #2565 for in-depth discussion.