back to simpler flush() code