add callback to sync function