fix divisor = 0 case