error handling and filenames