Adding checks for unexpected types to the c++ serializers