Fix a potential divide-by-zero