fix bug caused by dir modification