Fixed writing of chars in buffers