fixed the detection