adds code to handle a failure to create directories