Fixing Bugs in Collection Count script