Fix possible division by zero.