Use detect_safe() instead of detect() again.