fix ranges to be min-max