change str to ring buf