get unit count dynamically
handle unit_count > pixlib_count