Fix bug in processing directories.

Previous commit introduced an error with processing directories.