don't report twice that file is a directory
correct mistypes
improved log_file_error()
improved directory scanning