make_base_directories(): allow multiple path with the same directory in separate transactions, fix count issue