fixed a bug in the directory class which caused a crash when recursively traversing some directories