SetSkeletalMesh changes the mesh but uses old materials

When I’m using SetSkeletalMesh the skeletal mesh does change, but the materials don’t, and it is using the old ones.

The mesh is changed based on user input. What can I do to avoid this?