You should never assign anything to a variable called $M2. This is the communication handle to the Moski2Engine, and if you loose it your site will die.
$M2