fixed num_items_of_type()