Rotator Bug: Add Local Rotation in Yaw Axis causes rotation axis to flip suddenly

Hi. I am struggling with Rotator axis flipping problem.

I am making a program that takes screenshot of a human from 360 degrees (azimuth) with 18 degree intervals using Blueprint.

So there is a human in the middle and a camera is rotating around the human with same distance. Basically this camera is attached to the spring arm, and this spring arm is attached to the human in the middle.

Every tick, I make a rotator with desired yaw axis ( I am making sure the yaw value is 0-360 by mod 360 ), add the delta rotation to the spring arm by using “AddLocalRotation” node. (I cannot use SetRotation since spring arm is the child component, not actor)

For certain amount of time, this works perfectly without problem. The camera rotates around the human as desired for certain amount of iterations (rotating 0-360 degrees without any problems). But suddenly, the timing is always random but when the camera goes from 340-degree to 360-degree , the rotation is flipped like the attached screenshot. (You can see that in the middle row, the rotation axis is flipped). The weird part is that this flipping happens only once and then my program continues to take screenshot in the flipped axis.

I also attached the blueprint I am using. Although there is a node, I am not giving any elevation (pitch) to the rotator.

Could you help me figure this out? Any help would be greatly appreciated. Thank you!