Fix compilation warnings.
Minor refactoring HierarchyListener. Fix some compilation warnings.