Add deserializer tests; fix a couple bugs that came up as a result.