Gold glitch (stuff)

i had around 19k gold left while i was upgrading and stuff then i accepted my daily achievments then my gold shot up to 198k i was about to try spend it but didnt want to get banned for accidental duping so i logged out and logged back in and my gold was normal.
this is kinda similar to me not getting my lvl up gold right away but after a refresh or relog i get the gold.
so i can anyone explain y this happens or …