Fix detect_sources