adding flags and escape bytes
fixes for dynamic buffering