add range support for levels, fix hierarchy consistency checks