bug fixes in hierarchy construction; seems to work without fail at least on simple models