stacks: fix handling of elements inside links.