Fix possible divide by zero.