Prevented crashing when invalid file name was entered and if -S was used
incorrectly