add callback with error support