Fix type variables in serialization.