Fix serializing with interfaces (traits)