fix callback count logic