Prevent divisions by zero in metric calculations