Fix bug in processing directories.