Improve hierarchy building debug and error messages