Added check for bad file names