Fixed a bug in searchDir() function.