bugfix: buildStructure must work in recursion