fix bug for dir