change num_of_kinds type to size_t