fix a charbuffer bug