Improve deserialize_* functions