Fixed bug with illegal characters in filenames