fixed errors when there are spaces in filenames