Bug fixes for JSON generation.