Properly count the number of libraries.