Fix divide by zero exception