Some bugs fixes wrt the detector