Fix problems with the serializer when using 'type' as an attribute

fixes #7372