Well, I can't see anything that could cause that, but you should know that the way you're calculating the average is incorrect. You're giving much more weight to the first values than to the last ones.
Never mind. I thought because it was inside the loop you were doing something else, which is a common mistake.
Yes, the way you're doing it will give the correct result, but there no reason why it needs to be inside the loop.