Fix broken type legalization of min/max