patch to fix stupid flush error handling