Avoid division by zero in safePercentile