some fixes for the detection part