Fixed a potential divide by zero