improve callback handling