added checks for filenames