Some fixes and logging code for the JSON serializer