decode headers correctly