why sort and min do not work together