Array Modifier deforming mesh
The curve contains too many unnecessary points. Additional curvatures will bend the object where you don't want.

For better control in this case, I suggest to separate planks from poles, making them as two individual objects. Then use one simplified curve (or two curves) to control each of them.