Fixed miscounting number of bytes for hierviews.
Added a utility function updated changes.