If this function is called from multi threads it might need locking in order to not use the same count?