fix for hierarchical joins (more than one level)