diff --git a/feature_stream.go b/feature_stream.go
index <HASH>..<HASH> 100644
--- a/feature_stream.go
+++ b/feature_stream.go
@@ -184,14 +184,14 @@ func (stream *Stream) Flush() error {
 func (stream *Stream) ensure(minimal int) {
 	available := stream.Available()
 	if available < minimal {
-		if stream.n > 1024 {
-			stream.Flush()
-		}
 		stream.growAtLeast(minimal)
 	}
 }
 
 func (stream *Stream) growAtLeast(minimal int) {
+	if stream.out != nil {
+		stream.Flush()
+	}
 	toGrow := len(stream.buf)
 	if toGrow < minimal {
 		toGrow = minimal
ensure buffer flushed to io.Writer