did error handling for ar_detect