bunch of fixes to minting.php