fix bug handling directory paths