better handling of missing directories