fixed a division by zero