Added creation of missing directories