Better testing of directory management and handling of unexpected state