Fixed issue when directory does not exist