fix bug with nil jsonWriter