fix bug with callback handling