So, you put a breakpoint somewhere early in that code then stepped through looking at what x value it is writing, and they looked correct when they were written? If that is the case, then something else is changing them later.