Problems with importing rigs from blender to ue5

I create a rig in blender, parented it with the automatic weights and then export it to unreal, but then the bones at the end of the hierarchy is missing in unreal, turning leaf bones solves the problem but there are still other problems. The names of the bones get messed up, the mesh doesn’t follow when the bone moves, there are duplicate of the root bones. By root bones I mean this bone

There are duplicates of it for some reason in unreal