fix too early headers sent