Added check for incorrect filenames