fix collect_max to handle any primitive types, and add collect_min