fix bug of test in directory exist