Update some code to use ensure_capacity_leaf for hierarchical_kernel