Modified Mage.php for Version 1.7.0.2