Magnesium and calcium are like dance partners in that if you raise magnesium, you will dump calcium and vice versa. It is quite possible that you are wasting calcium by adding the magnesium although this occurs in fewer people. Muscle twitching could be from calcium depletion, try adding a little calcium (high quality) and see if that helps (stop the magnesium for now).
It is also quite possible that there may be some interactions with the potassium/sodium balances as well. And remember that sodium/potassium have the same interactions as the calcium/magnesium.
You will have to rule out what is causing the problem by simple experimentation. As a previous poster mentioned, magnesium oxide is a poor form of magnesium.
Exatest or traceelements.com are great tests for observation of the critical balances of minerals. Highly suggested.