Fix a JSON Unicode serialization bug, and add more tests