bug fix of directory stack