Moved the count test after all the objects have been created.