Add some division by zero checks