Hi, I'm hit by the following bug in `org-element-cache-map'. When I use `tags' or `tags-todo' in an agenda, with the option `(org-tags-match-list-sublevels nil)', all sub-elements of a matching item are correctly skipped except the last one. It can be reproduced with the following org file: * TODO Parent ** TODO Child 1 ** TODO Child 2 and the following agenda: (setq org-agenda-custom-commands '( ("t" "Test" ( (tags-todo "-foo" ((org-tags-match-list-sublevels nil))) (tags "-foo" ((org-tags-match-list-sublevels nil))) ) ((org-agenda-files '("~/org/test.org")))))) With `(org-tags-match-list-sublevels t)', I correctly see all 3 elements. With `(org-tags-match-list-sublevels nil)', I see Parent and Child 2. This wasn't the case on an older version of org-element that didn't make use of the cache. I understand the option `org-tags-match-list-sublevels' is semi-deprecated in favor of proper tag inheritance configuration. However, to the best of my understanding, I can't accomplish "list all todo items except those tagged with foo, and skip children of matching entries" with tag inheritance. Patch is attached. Happy to iterate over it in case my understanding of this rather complex function is flawed. I tested it on my org files, and would of course appreciate if others could test. Best, -- Matthieu