Correct modulus for negative numbers.