try setting the header earlier