fix remainder for equal values