fixed bug in min-max selection