Convert StateDetails back to the old format.
Fix a few more bugs.