Replace ~str with StrBuf