correct HTTP headers on errors