tweaks to detect_threshold