avoid division by zero when computing  thresholds