changing detect to directory