Fixed bug relating to negative modulus.