Fixed bug: handling directory with spaces