How can I straighten out the sudden rotations along the axis of the meshes on this spline?

There are a few places along this looping spline where the mesh suddenly turns 90 or 180 degrees. It happens where the straight sections of it begin and end, and in one other spot. I don’t see any settings that seem to affect it, the rotations listed for each point on the spline are the same. How can I fix this?