Changed Enumerable#min_by and #max_by implementation