Division by zero bugfix