Fix a bug where JSON was lost when saving invalid options