Fixed crashes for invalid file names