Fixed bug in encoding short strings