Fix gcd scaling, add resultant over residue rings.