Fix Detector crashes (and a similar instance in decoder)