refactory to avoid creating new buffer in string2KV