fix min/max digit bug

when setting max, downgrade min to max if min > max
when setting min, upgrade   max to min if max < min