Added some internal code to allow strings to be written out in a more JSON friendly manner.
Small type fix in tbs server code.