Fix potential divide by zero error.