create directory, and don't read non-files
Various bug fixes.