Closes #2067

Fixes deserialization issues with the KeyValuePair type when it is used outside of dictionaries