Added (detect_left_flag == 0 && detect_right_flag == 0) case