Serialization and type resolution bug fixes