More robust handling of filenames.