Fixed a possible division by zero.