[WIP] streambuf fixes