
394 S.E.2d 764 (1990)
UNITED STATES FIDELITY AND GUARANTY COMPANY, a Corporation
v.
Orion M. HATHAWAY and Vivian M. Hathaway.
No. 17900.
Supreme Court of Appeals of West Virginia.
June 22, 1990.
*765 W. Henry Lawrence, IV, Steptoe & Johnson, Clarksburg, for USF & G Co.
Caton N. Hill, Jr., Philippi, Jerald E. Jones, Jones, Williams, West & Jones, Clarksburg, for Orion M. Hathaway, Vivian M. Hathaway.
MILLER, Justice:
United States Fidelity and Guaranty Company (USF & G) appeals from an order of the Circuit Court of Barbour County, dated September 29, 1986, which granted Vivian M. Hathaway's motion to dismiss. We find that the trial court committed reversible error when it granted Mrs. Hathaway's motion to dismiss, and, accordingly, we reverse and remand the case for further proceedings.

I.
Orion M. Hathaway and Vivian M. Hathaway are husband and wife. Mr. Hathaway was the sole proprietor of a construction business called Hathaway Construction Company (the Company). As is common in the construction business, the Company had to acquire performance bonds (bonds) which guaranteed completion of each new job. USF & G agreed to issue bonds on behalf of the Company, thus acting as the Company's surety, if both Mr. and Mrs. Hathaway agreed to indemnify USF & G. On March 23, 1976, both Mr. and Mrs. Hathaway signed what was termed a master surety agreement (the agreement) in which they both agreed to indemnify USF & G if the Company defaulted on one of its construction jobs, and USF & G had to pay the Company's creditors pursuant to the terms of the bond.[1]
*766 During 1976 through 1979, USF & G apparently provided several bonds on behalf of the Company, a sole proprietorship. In 1979, the Company incorporated under the same name (the Corporation). The agreement was not amended to reflect the change in legal status.
On December 1, 1983, USF & G issued a bond to insure completion of the Courtland Acres housing project for the elderly in Thomas, West Virginia. On July 9, 1985, the Corporation defaulted on the Courtland Acres project, and pursuant to the terms of the bond, USF & G paid the Corporation's creditors a total of $264,106.06.[2]
Subsequently, USF & G sought indemnification from Mr. and Mrs. Hathaway. When the Hathaways refused to compensate USF & G, it commenced a civil action on December 6, 1985, against them. In addition to their answer to the complaint, the Hathaways filed a motion to dismiss Mrs. Hathaway as a party defendant on the ground that she did not have an interest in the Corporation. The motion to dismiss further alleged that dismissal was appropriate because the bond guaranteeing performance on the Courtland Acres project was executed on behalf of the business after it had incorporated, and the agreement only required Mrs. Hathaway to indemnify losses for bonds issued on behalf of the sole proprietorship.[3] The trial court granted Mrs. Hathaway's motion to dismiss by an order dated September 29, 1986.[4]

II.
USF & G argues that it was error for the trial court to grant Mrs. Hathaway's motion to dismiss for failure to state a claim upon which relief could be granted pursuant to Rule 12(b)(6) of the West Virginia Rules of Civil Procedure. When, as was the case here, a trial court considers matters outside of the pleadings, such as the discovery material, the motion should be treated as one for summary judgment. We summarized this rule in the Syllabus of Dunn v. Consolidation Coal Co., ___ W.Va. ___, 379 S.E.2d 485 (1989):
"`Only matters considered in the pleading can be considered on a motion to dismiss under Rule 12(b), R.C.P., and if matters outside the pleading are presented to the court and are not excluded by it, the motion should be treated as one for summary judgment and disposed of under Rule 56 R.C.P. ...' Syllabus point 4, in part, United States Fidelity & Guaranty Co. v. Eades, 150 W.Va. 238, 144 S.E.2d 703 (1965)."
See also Stark Elec., Inc. v. Huntington Housing Auth., ___ W.Va. ___, 375 S.E.2d 772 (1988); Calacino v. McCutcheon, ___ W.Va. ___, 356 S.E.2d 23 (1987); Calvert Fire Ins. Co. v. Bauer, ___ W.Va. ___, 332 S.E.2d 586 (1985); United States Fidelity & Guar. Co. v. Eades, 150 W.Va. 238, 144 S.E.2d 703 (1965).
When we consider dismissal under summary judgment, the inquiry is whether there were any genuine issues of material fact. As we outlined in our seminal case of Aetna Casualty & Surety Co. v. Federal Insurance Co., 148 W.Va. 160, 133 S.E.2d 770 (1963), where we held in Syllabus Point 3:

*767 "A motion for summary judgment should be granted only when it is clear that there is no genuine issue of fact to be tried and inquiry concerning the facts is not desirable to clarify the application of the law."
See also Prudential Ins. Co. v. Couch, ___ W.Va. ___, 376 S.E.2d 104 (1988); Lowery v. Raptis, ___ W.Va. ___, 329 S.E.2d 102 (1985); Hoskins v. C & P Tel. Co., 169 W.Va. 397, 287 S.E.2d 513 (1982); Karnell v. Nutting, 166 W.Va. 269, 273 S.E.2d 93 (1980).
Mrs. Hathaway maintains that she was a gratuitous surety because she received no consideration for signing the agreement. She points to Koblegard Co. v. Maxwell, 127 W.Va. 630, 34 S.E.2d 116 (1944), where we held that a gratuitous surety is favored by the law, and, if there is any material modification in the suretyship contract without the surety's consent, the gratuitous surety is relieved of liability.[5] Mrs. Hathaway argues that there was a material modification in the agreement when USF & G acted as surety on the Corporation's construction contracts because she had only agreed to indemnify USF & G on bonds issued on behalf of the sole proprietorship.
From a purely technical standpoint, Mrs. Hathaway was not a surety. Courts have held that contracts similar to that executed by Mr. and Mrs. Hathaway are indemnity agreements. See, e.g., United Bonding Ins. Co. v. Mohr, 370 F.2d 551 (2d Cir.1966); United Pac. Ins. Co. v. Johnson-Gillanders Co., 280 F.Supp. 90 (D.N. D.1968); Balboa Ins. Co. v. Webster, 447 So.2d 992 (Fla.App.1984). This interpretation comports not only with the language of the agreement, see note 1, supra, but also with the actual transaction.
By issuing the performance bonds for construction work performed by the Corporation on behalf of third parties, USF & G directly guaranteed the Corporation's performance to the third party. On the other hand, in the indemnity agreement, the Hathaways did not assume any direct obligation to third parties, but merely agreed to reimburse or indemnify USF & G for its losses. We explained the distinction between suretyship and indemnity in State ex rel. Copley v. Carey, 141 W.Va. 540, 549, 91 S.E.2d 461, 467 (1956):
"There is a vital distinction between a contract of suretyship and a contract of indemnity. In a contract of suretyship the obligation of the principal and his surety is original, primary and direct and the surety is liable for the debt, default or miscarriage of his principal. A contract of indemnity is likewise an original undertaking and creates a primary obligation, but the promise of the indemnitor, in a contract of indemnity against loss sustained by the person indemnified, is not to answer for the debt, default or miscarriage of another person but is to make good the loss which results to the person indemnified from such debt, default, or miscarriage." (Citations omitted).
Even though Mrs. Hathaway is an indemnitor, she has much the same defense as if she were a surety: If there is a material change by the indemnitee in the undertaking indemnified without the consent of the indemnitor that increases the risk to or prejudices the indemnitor, then the indemnitor may be discharged from liability. E.g., General Ins. Co. v. Fleeger, 389 F.2d 159 (5th Cir.1968); Hiern v. St. Paul-Mercury Indem. Co., 262 F.2d 526 (5th Cir.1959); American Casualty Co. v. Idaho First Nat'l Bank, 328 F.2d 138 (9th Cir.1964); Denton v. Fireman's Fund Indem. Co., 352 F.2d 95 (10th Cir.1965); United Pac. Ins. Co. v. Johnson-Gillanders Co., supra; United States Fire Ins. *768 Co. v. Johansen, 270 Cal.App.2d 824, 76 Cal.Rptr. 174 (1969); Rosenbloom v. Feiler, 290 Md. 598, 431 A.2d 102 (1981); New Amsterdam Casualty Co. v. Lundquist, 293 Minn. 274, 198 N.W.2d 543 (1972); Holiday Inns, Inc. v. Thirteen-Fifty Inv. Co., 714 S.W.2d 597 (Mo.App.1986); Huck v. Gabriel Realty, 136 N.J.Super. 468, 346 A.2d 628 (1975). See generally 41 Am. Jur.2d Indemnity § 37 (1968 & Supp.1990).
In the present case, there was a genuine issue of material fact as to whether USF & G's issuance of surety bonds to the Corporation substantially prejudiced Mrs. Hathaway who only agreed to act as an indemnitor for the Company when it was a sole proprietorship. Most of the discovery undertaken below focused on whether Mrs. Hathaway was a gratuitous surety. USF & G argues that Mrs. Hathaway was not a gratuitous surety because she occasionally used company credit cards for her personal expenditures and was supported by Mr. Hathaway, who, in turn, derived his livelihood from the business. Finally, USF & G asserts that in the agreement itself, Mrs. Hathaway represented that she had a substantial and beneficial interest in the Company.
These considerations may have some relevance to the status of a gratuitous surety. However, they are inconsequential to an indemnitor. The chief inquiry that must be made on remand is whether Mrs. Hathaway, as an indemnitor, was subject to an increased risk of harm or prejudice as a result of USF & G's continuing to write performance bonds for the business after its incorporation.
Accordingly, we reverse the trial court's decision granting Mrs. Hathaway's motion to dismiss and remand the case for further proceedings consistent with this opinion.
Reversed and remanded.
NOTES
[1]  The indemnity provision states, in pertinent part:

"III (A) UNDERSIGNED shall exonerate, indemnify, and keep indemnified SURETY from and against any and all liabilities, losses and expenses of whatsoever kind or nature (including but not limited to, interest, court costs and counsel fees) imposed upon, sustained, or incurred by SURETY by reason of: (1) SURETY having executed, provided or procured BOND(S) in behalf of PRINCIPAL, or (2) UNDERSIGNED'S failure to perform or comply with any of the provisions of this AGREEMENT[.]"
[2]  The Corporation received a $27,900.60 credit from the Courtland Acres Association upon final payment to the creditors; thus, the total amount owed USF & G was $236,205.46.
[3]  Through discovery, USF & G determined that Mr. Hathaway only contested $17,605.15 of the $236,205.46 that USF & G asserted was owed them. Accordingly, USF & G moved for partial summary judgment against both of the Hathaways for the uncontested amount of $218,600.31 plus interest. The trial court granted partial summary judgment against Mr. Hathaway, but denied partial summary judgment against Mrs. Hathaway.
[4]  USF & G, prior to the dismissal of Mrs. Hathaway, moved to amend its complaint to add an additional cause of action. The trial court refused USF & G's motion by an order dated October 7, 1986. In view of our holding, we decline to discuss the amendment issue which appears to relate to the gratuitous surety question.
[5]  These principles were set out in Syllabus Points 5 and 6 of Koblegard Co., supra:

"5. In the application of a contract of suretyship, as distinguished from its construction, the rule of strictissimi juris applies to a gratuitous surety.
"6. Any material modification of a contract of gratuitous suretyship resulting from an agreement between the creditor and principal, whereby the former is bound, made with the creditor's knowledge of the suretyship and without the surety's consent, will operate to effect a discharge in toto."
