bug fix

fix a potential of division by zero