fixed bug when there are spaces in filename