Fixed some bugs in directory_findname