handle headers in callback