Fixed bug in string encoding.