fix bug and add select directory