Fixed Detector code. See #3871.