MM Fixed issues with sql on check.php