added null check, because it can be that the detector is not produced
this logic was moved to the module