fix res.appendHeader to keep correct order