Fixed a few bugs with JsonWriter