multi-item fix

This fixes the issue of bags in two ways:
one, I was passing the 'root' element and not the iterated item
two, I generated a static function leaf_element -- this returns the outermost 'first' element, so be careful if your branch splits on the way and you care