Fixes to the write string function.