limit recursive expansion to 7 levels

The schema 04 definition is recursive. Expansion of the whole schema thus is impossible.

This patch limits the expansion to 7 levels, which should be ok as a temporary fix.
The correct solution is of course not to do expansion at all, but that will take much work.