recursive hierarchical query bugfix