Make isUnit work for non-prime Z/mZ