I think problem is lack of magnesium in your body. When this sort of thing happens, chances are that it's 99% due to the lack of that essential mineral/vitamin in one's body. Unfortunately, due to the consumption of refined foods, large number of population is deficient of this crucial vitamin.
Try taking magnesium supplement for a week and I'm almost pretty sure it'll get rid of the problem. Just buy it from your local health store and take it for a week or two. The only side affect is rapid bowel movement and/or diarrhea.