fix bug when directory has spaces