Added bug fixes for hierarchical