implemented a counter for registered callbacks