2D platformer Parallax scrolling background problem


I’m having a problem with my parallax scrolling background. The scrolling seems to work, but my background’s position “teleports” to a different position each time I change movement direction or go from moving back into idle… it looks like the background image is getting flipped horizontally each time a change in movement direction or idle is happening.

Any idea why this is happening?

Thanks in advance!

attached is an image of my code