fix minor bugs with detection routine