update container counting to check for exact size, handle root no-container case