Fixed critical bug causing incorrect target detections.