Make ObjectCounter Serializable
merge of '4f6d64a50c7c5c27682914984831fc581724659d'
     and 'e5def490e4eba793ca0d2bcb739771dcdf8c0242'