Reverted certificate.php back to older version.
Added checks for whether the duplicate course exists or not.