FIX Flush on memory exhaustion and when headers sent