fixed bug in AddStringToBuffer