
551 P.2d 525 (1976)
Ben Lee WILSON, Plaintiff-Appellant,
v.
KEALAKEKUA RANCH, LTD. and Gentry Hawaii, Defendants-Appellees.
No. 5611.
Supreme Court of Hawaii.
June 22, 1976.
*526 Tom C. Leuteneker, Carlsmith, Carlsmith, Wichman & Case, Hilo, for plaintiff-appellant.
Lincoln J. Ishida, Kaito & Ishida, Henry N. Kitamura, Honolulu, for defendant-appellee Gentry-Hawaii.
Before RICHARDSON, C.J., and KOBAYASHI, OGATA, MENOR and KIDWELL, JJ.
RICHARDSON, Chief Justice.
This appeal arises from a contract action brought by plaintiff-appellant Ben Lee Wilson (hereinafter, Wilson) against defendant-appellees Kealakekua Ranch, Ltd. and Gentry Hawaii (hereinafter, Gentry) for architectural and engineering services rendered from February, 1972 through May, 1972 for the Kealakekua Ranch Center Project. Wilson claims that $33,994.36 is due him for services provided. Jury-waived trial commenced on June 13, 1973.
On direct examination, Wilson testified that he was licensed to practice architecture in this State. On cross-examination, however, after challenge by opposing counsel, Wilson admitted that he was not a registered architect at the time he rendered architectural services for Gentry, as his license had lapsed on April 30, 1971 for failure to pay the renewal fee for the succeeding period.
After Wilson rested, Gentry, citing HRS § 464-2, 464-9, 464-11, and 464-14, moved to dismiss the complaint on the ground of illegality in that Wilson was not a duly licensed architect at the time he rendered services for Gentry. Plaintiff argues that the affirmative defense of illegality was not available to Gentry since its failure to plead illegality in its answer effected a waiver of that defense.
The trial judge granted the motion to dismiss, having concluded that the contract between Wilson and Gentry was null and void because of Wilson's noncompliance with HRS § 464-2.[1]
On appeal, Wilson contends that the trial judge erred by (1) considering the affirmative defense of illegality and (2) concluding *527 that the contract was null and void because of Wilson's noncompliance with HRS § 464-2.

I
The defendant did not plead illegality as an affirmative defense in its answer but raised it at trial on a motion to dismiss after the plaintiff had presented and closed his case. Wilson argues that the failure to plead the defense effected a waiver. H.R.C.P. Rule 8(c) provides that in "pleading to a preceding pleading, a party shall set forth affirmatively ... illegality ... and any other matter constituting an avoidance or affirmative defense." Rule 15(b), H.R.C.P., states, however, that:
"When issues not raised by the pleadings are tried by express or implied consent of the parties, they shall be treated in all respects as if they had been raised in the pleadings. Such amendment of the pleadings as may be necessary to cause them to conform to the evidence and to raise these issues may be made upon motion of any party at any time, even after judgment; but failure so to amend does not affect the result of the trial of these issues... .."
In Godoy v. Hawaii County, 44 Haw. 312, 321-2, 354 P.2d 78, 83 (1960), this court said that:
"The effect of this provision [Rule 15(b)] is stated in Moore, Federal Practice, 2d Ed.Vol. 2, p. 1696 note 30, as follows: `Failure to plead an affirmative defense is immaterial if evidence of the defense is introduced and not objected to for failure to plead it, and no surprise is claimed.' The statement is, as a general proposition, borne out by the authorities." (Citations omitted).
Professors Wright and Miller concur, stating, "if evidence relating to an unpleaded affirmative defense is introduced without objection, Rule 15(b) requires the issue to be treated as if it actually had been raised by the pleading." 6 Wright and Miller, Federal Practice and Procedure § 1492 at 457 (1971).
The record indicates that evidence relating to the illegality defense was introduced without objection at trial. In fact, it was Wilson who at the very outset of the trial gave direct testimony that he was licensed in Hawaii. On cross-examination, Wilson responded to questions about licensure and testified that he was not licensed, without objection from his counsel.
We think the failure to object to the introduction of evidence respecting illegality triggers the operation of H.R.C.P. Rule 15(b) which mandates that when an affirmative defense is tried by the implied consent of the parties, it shall be treated as if raised in the pleadings. We find, therefore, no waiver by Gentry of the illegality defense for failure to plead it in Gentry's answer.

II
The trial judge found the contract illegal and therefore null and void. However, Professor Corbin takes the following view:
"It is far from correct to say that an illegal bargain is necessarily `void,' or that the law will grant no remedy and will always leave the parties to such a bargain where it finds them... . Before granting or refusing a remedy, the courts have always considered the degree by the offense, the extent of public harm that may be involved, and the moral quality of the conduct of the parties in the light of the prevailing mores and standards of the community." 6A Corbin on Contracts § 1534 p. 816 (1962).
The Restatement of Contracts, § 600, likewise indicates that under certain circumstances an illegal contract may be enforced by the courts:
"If neither the consideration for a promise nor the performance of the promise in an illegal bargain involves serious moral turpitude, and the bargain is not prohibited by statute, it is enforceable unless the plaintiff's case requires *528 proof of facts showing the illegality, or they are pleaded by the defendant, and even in that event recovery may be allowed of anything that has been transferred under the bargain, or its fair value, if necessary to prevent a harsh forfeiture." (p. 1115) (emphasis added).
Where, as here, the statute provides a criminal sanction but is silent as to whether its violation will deprive the parties of their right to sue on the contract, the courts have distinguished between statutes for revenue and statutes for protection of the public against incompetence and fraud. Su Ping Ying v. Parke, 4 Haw. 9 (1877); Bankruptcy of Daniels, 8 Haw. 746 (1892); Garvin v. Gordon, 36 N.M. 304, 14 P.2d 264 (1932). If the purpose of the statute is for the collection of revenue, the express statutory penalties are held to be exclusive and contracts made without a license are not thereby rendered unenforceable. On the other hand, if the statute is for the protection of the public against fraud and incompetence, it is more likely that the statute breaker will be denied the enforcement of his bargain. However, as Corbin, supra, points out:
[E]ven in these cases enforcement of the wrongdoer's bargains is not always denied him. The statute may be clearly for protection against fraud and incompetence; but in very many cases the statute breaker is neither fraudulent nor incompetent. He may have rendered excellent service or delivered goods of the highest quality, his non-compliance with the statute seems nearly harmless, and the real defrauder seems to be the defendant who is enriching himself at the plaintiff's expense. Although many courts yearn for a mechanically applicable rule, they have not made one in the present instance. Justice requires that the penalty should fit the crime; and justice and sound policy do not always require the enforcement of licensing statutes by large forfeitures going not to the state but to repudiating defendants.

It must be remembered that in most cases the statute itself does not require these forfeitures. It fixes its own penalties, usually fine or imprisonment of minor character with a degree of discretion in the court. The added penalty of non-enforceability of bargains is a judicial creation. In most cases, it is wise to apply it; but when it causes great and disproportionate hardship its application may be avoided. ... 6A Corbin on Contracts § 1512, pp. 712-714 (1962).
Thus in John E. Rosasco Creameries v. Cohen, 276 N.Y. 274, 11 N.E.2d 908 (1937), where the primary purpose of the statute requiring milk dealers to be licensed was to protect the public, the court held that the contract of an unlicensed milk dealer was enforceable, stating:
"Illegal contracts are generally unenforcible [sic]. Where contracts which violate statutory provisions are merely malum prohibitum, the general rule does not always apply. If the statute does not provide expressly that its violation will deprive the parties of their right to sue on the contract, and the denial of relief is wholly out of proportion to the requirements of public policy or appropriate individual punishment the right to recover will not be denied... ." (11 N.E.2d at 909).
In holding the contract enforceable, the Rosasco court relied on the fact that there was no express or implied legislative intent to deprive unlicensed dealers of the right to recover.
While the test of revenue raising as opposed to protection of health, safety, and welfare is helpful and often indicative, what ultimately must be ascertained is legislative intent. Harris v. Runnels, 53 U.S. (12 How.) 79, 13 L.Ed. 901 (1851); Restatement of Contracts § 580, Comment (a). We agree with the court in Rosasco that where a statute is silent with respect to the enforceability of a contract whose performance is malum prohibitum, the legislature could not have intended unenforceability *529 where a forfeiture, wholly out of proportion to the requirements of public policy or appropriate individual punishment, would result and redound solely to the benefit of the defendant.
In the instant case, the trial judge determined that Wilson had violated HRS § 464-2 and 464-9[2] and that such provisions were enacted for the health, safety, and general welfare of the public. The penal provisions in the same statute, § 464-14, provide that:
"Any person who practices ... architecture ... without having first registered in accordance with this chapter and without having a valid unexpired certificate of registration ... shall be fined not more than $500 or imprisoned not more than one year, or both." (Emphasis added.)
It is not disputed that Wilson was first registered in accordance with the statute in 1967. At that time, the Board of Registration [hereinafter, the Board] determined that Wilson was of sufficient knowledge, skill, competence, character, and reputation to practice architecture in this State. Wilson subsequently renewed his registration by payment of the $15.00 annual fee for periods up to April 30, 1971. Wilson's failure to remit the renewal fee for the succeeding period caused his certificate of registration to expire and become invalid. HRS § 464-9. The statute does provide an automatic "grace period" of one year from the expiration date (here, April 30, 1971) during which time the certificate of registration may be reinstated upon payment of a $30.00 fee. Id. Wilson, however, failed to tender such a fee prior to April 30, 1972, after which time it appears, though the statute does not expressly state, Wilson would have been required to apply for registration again. There was no evidence adduced at trial as to whether, upon reapplication for registration, the Board would have made a reinvestigation and reexamination or would have simply required payment of the $30.00 application fee.
The evidence adduced by the plaintiff at trial does indicate that Wilson performed architectural services for Gentry from February through May, 1972, thereby violating HRS § 464-14 by practicing architecture "without having a valid unexpired certificate of registration," thus rendering himself liable to a fine of not more than $500 and/or imprisonment for not more than one year.
While the provisions of the statute requiring initial registration are clearly designed to protect the public from unfit and incompetent practitioners of architecture, we think that the provision requiring renewal, with which Wilson failed to comply, is purely for the purpose of raising revenues. Renewal involves nothing more than the remittance by the registrant and receipt by the Board of the annual $15.00 renewal fee. Reexamination and reinvestigation play no part in the renewal process. Once registered, the statute prescribes scrutiny by the Board only when a charge has been filed with the Board that an architect is guilty of negligence, incompetence, misconduct, or violation of the statute or rules. § 464-10 HRS.[3] In the absence of such a charge, there is no further review of an *530 architect's compentence or character in addition to that made at time of application for registration.
Furthermore, we see no relationship between the payment of annual fees and the competence or character of an architect. The failure to remit such fees does not indicate deterioration of the compentence or integrity required to qualify for registration as an architect. We conclude, therefore, that the provision requiring renewal by way of payment of a $15.00 fee was not for public protection, but for revenue.
Our inquiry does not end with the determination that Wilson's noncompliance was with a revenue raising provision. As above indicated, legislative intent is dispositive. Even assuming, arguendo, that the statutory provisions with which Wilson was in noncompliance had a protection component, we do not believe that the legislature intended unenforceability in addition to the penal sanctions of § 464-14, since unenforceability would result in a forfeiture wholly out of proportion to the requirements of public policy or apropriate individual punishment.
Wilson's failure to remit the $15.00 renewal fee for two years already renders him liable to a fine of up to $500 and/or imprisonment for up to a year. HRS § 464-14. Finding the contract unenforceable, null and void, would impose an additional punishment of up to $34,000[4], redounding to the benefit of the defendant. While the public has a legitimate interest in assuming the collection of revenues, we think that the penal sanctions in the instant case are more than adequate to secure that interest. Additional punishment, especially a disproportionate forfeiture, is not justified and could not have been intended by the legislature.
An additional point bears significance, though we do not rely on it in reaching our result. The fact that in another professional licensing situation the legislature has explicitly provided for nonenforceability of contracts increases the possibility that, if the legislature had intended unenforceability here, it would have expressed such an intent. The contractors' licensing statute does provide for nonenforceability of contracts in addition to penal sanctions:
"§ 444-22 Civil action. The failure of any person to comply with any provision of this chapter shall prevent such person from recovering for work done, or materials or supplies furnished, or both on a contract or on the basis of the reasonable value thereof, in a civil action, if such person failed to obtain a license under this chapter prior to contracting for such work."
It is noteworthy that the architects' licensing statute contains no such provision.
We conclude, therefore, that the contract between the parties is not void and that the motion to dismiss was improperly granted.
Reversed and remanded for further proceedings.
KOBAYASHI, OGATA, MENOR and KIDWELL, JJ., concur.
NOTES
[1]  HRS § 464-2 states, in relevant part:

"In order to safeguard life, health, and property, no person ... shall practice ... architecture . .. unless he is duly registered under this chapter."
[2]  See HRS § 464-2 at n. 1. HRS § 464-9 stated, in relevant part:

"Every certificate of registration expires on April 30 following its issuance or renewal and becomes invalid after that date unless renewed. The secretary of the board shall mail, at least one month in advance of the date of expiration of the certificate of registration, a notice to every person registered hereunder giving the date of expiration and the amount required for the renewal thereof. The fee for renewal shall be $15 for each renewal certificate. Certificates of registration which have expired for failure to pay renewal fees on or before the date hereinabove required may be reinstated within one year of the expiration date upon payment of a fee of $30 for each renewal certificate."
[3]  HRS § 464-10, in relevant part, states:

§ 464-10 Suspension or revocation of certificates. The board of registration of professional engineers, architects, and surveyors may revoke or suspend the certificate of registration of any person hereunder who is found guilty of any fraud or deceit in obtaining the certificate or of gross negligence, incompetency, or misconduct in the practice of his profession or who is convicted of violating this chapter or the rules or regulations of the board. Any person may prefer charges in writing with the secretary of the board against any person holding a certificate... . It shall require a unanimous vote of the members of the board present at the hearing in order to find the accused guilty of the charges preferred, and if found guilty the board shall, in its discretion, either revoke or suspend the certificate of registration of the accused.
[4]  In his complaint, plaintiff alleges that defendant owed him $33,994.36 for architectural and engineering services.
