Another possible source of math error is where you're getting your calorie-counting information. Some sites/calculators do nut subtract sugar alcohol or fiber calories.
Sugar alcohols can be tricky (because some people seem to be able to digest more calorie from them than others), but fiber calories SHOULD be subtracted because human beings can't digest them.
In the USA, Food manufacturers and calorie in resources are ALLOWED but not MADE to subtract the fiber calories. Many (perhaps even most) have the math "wrong."
If you're eating a lot of vegetables, but not subtracting the fiber calories (and assuming the pretty good odds that your calorie counter hasn't done so either), you could be overestimating your calorie intake rather dramatically.