
153 Cal.App.2d 828 (1957)
A. P. RUSSELLO, JR., Respondent,
v.
WILLIAM H. MORI et al., Appellants.
Civ. No. 17525. 
California Court of Appeals. First Dist., Div. Two.  
Sept. 16, 1957.
 McGilvray, McGilvray & Cameron and Hugh F. Melvin, Jr., for Appellants.
 Andrew P. Costelli and Richard C. Lynch for Respondent.
 KAUFMAN, P. J.
 Defendants appeal from an order denying their motion for a change of venue from Alameda County, which is the county of residence of the plaintiff and the defendant Hurlburt, to Sacramento County, which is the county of residence of the other defendants.
 The question presented on this appeal is whether the defendant Henry L. Hurlburt was improperly joined as a defendant for the sole purpose of having the action tried where he resided, so that his residence could be considered in determining the proper place for the trial of the action, pursuant to Code of Civil Procedure, section 395. The determination of this question under Code of Civil Procedure, section 379c, depends on whether the complaint states a cause of action against Hurlburt, which in turn depends on whether Hurlburt is personally liable as a coprincipal on the contract which is the subject matter of this action, as contended by the plaintiff, or whether he is not liable as an agent, as contended by the defendants. *830
 [1] The rules for the determination of the first issue here presented were clearly stated by this court in Gottesfeld v. Richmond Ice Cream Co., recently cited with approval in Dennis v. Overholtzer, 143 Cal.App.2d 606 [299 P.2d 950], and Wiley v. Long, 148 Cal.App.2d 230 [206 P.2d 1063], 115 Cal.App.2d 854, at page 856 [252 P.2d 973] as follows:
 "The question whether the resident defendant is improperly joined must be determined from an examination of the pleadings then before the court and '(i)f the allegations in question did no more than shadow forth the semblance of a cause of action they would be proof against assault upon the ground that they were sham and frivolous. ... It is enough ... upon the hearing and determination of the demand for a change of venue, that the cause of action purported to be stated against the ... defendant was apparently pleaded in good faith and is not, prima facie, so glaringly and vitally defective as to be beyond correction by amendment.' (McClung v. Watt, 190 Cal. 155, 160-161 [211 P. 17]; Mills v. Brown, 205 Cal. 38, 41 [269 P. 636]; Freeman v. Dowling, 219 Cal. 213, 216 [25 P.2d 980]; Independent Iron Works, Inc. v. American President Lines, Ltd., 35 Cal.2d 858, 860 [221 P.2d 939].)"
 [2] "In determining the question whether the resident defendant has been joined solely for the purpose of having the action tried in the county of his residence 'the real issue for determination by the trial court was whether plaintiff ... had a cause of action against the resident defendant.' (California Collection Agency v. Fontana, 61 Cal.App.2d 648, 653-654 [143 P.2d 507]; White v. Kaiser-Frazer Corp., 100 Cal.App.2d 754, 758 [224 P.2d 833]; Freedman v. Imperial Cattle Co., 112 Cal.App.2d 593, 597 [246 P.2d 986].) [3] It is also the rule 'that upon the hearing of such motion, the court should not try, upon conflicting affidavits, the issues of fact going to the merits of the cause of action stated against the resident defendant.' (California Collection Agency v. Fontana, supra, 61 Cal.App.2d p. 653; White v. Kaiser-Frazer Corp., supra, 100 Cal.App.2d 758; Freedman v. Imperial Cattle Co., supra, 112 Cal.App.2d p. 596."
 [4] Where the question presented is whether a defendant has been improperly joined for the purpose of having a cause tried in a particular court, the appellate court has a right to look behind the complaint. (Heringer v. Schumacher, 88 Cal.App. 349 [263 P. 550]; Eckstrand v. Wilshusen, 217 Cal. 380 [18 P.2d 931]; South v. Wishard, 123 Cal.App.2d 642 [267 P.2d 827].) *831
 The complaint filed by the plaintiff general contractor, states two separate causes of action: one for damages arising out of an alleged breach of the written contract between the parties and one for declaratory relief, to ascertain the obligations of the parties under their written agreement, the complaint meets the test set forth in Freeman v. Dowling, 219 Cal. 213 at page 216 [25 P.2d 980], that it need do "no more than shadow forth the semblance of a cause of action," and "is not, prima facie, so glaringly and vitally defective as to be beyond correction by amendment." [5, 6] As pointed out in Dallman Supply Co. v. Sweet, 86 Cal.App.2d 780, at pages 783 and 784 [195 P.2d 864], Code of Civil Procedure, section 379c, should be liberally construed and a complaint for declaratory relief is "legally sufficient if it sets forth facts showing the existence of an actual controversy relating to the legal rights and duties of the respective parties under a written instrument and requests that these rights and duties be adjudged by the court."
 Three written instruments are incorporated by reference into the complaint here filed. The first, dated June 30, 1955, is an agreement between William H. Mori and Ellen M. Mori designated as "Principals" and Henry L. Hurlburt, individually and doing business as Commodore Motel Developers Company, designated as "Agent," whereby Hurlburt agreed to obtain real property in Sacramento County for the Moris, and to have a motel constructed thereon, by one Ray M. Collins as general contractor. The agreement further provided that the balance of the purchase price was to be secured by notes and deed of trust to be obtained by agent or owner, and that the interest obligations incurred during production were the obligation of the agents. This agreement was signed by all three parties. The second agreement, dated September 7, 1955, and signed by Henry L. Hurlburt and Harry F. Dayton, provides that in consideration of $1,000, Harry Dayton, a licensed contractor agrees with Henry L. Hurlburt and Commodore Motel Developers Company that he will represent Hurlburt and the Motel Company and the Moris in facilitating the construction of the motel. The third agreement, which is the subject of this action, is dated September 7, 1955, and is expressly supplemental to and in conjunction with the agreement of June 30, and again designates the Moris as "Principals" and Hurlburt individually and doing business as Commodore Motel Developers, as "Agent." The agreement further provides as follows: *832
 "1. Principal and Agent agree that Al Russello, a licensed general contractor [plaintiff in this action], hereinafter referred to as 'Contractor,' shall act as contractor and builder of the motel described in the June 30, 1955 agreement above mentioned."
 "2. Contractor shall procure a surety bond, referred to as a 'Labor, Material and Completion Bond,' furnished by a surety company satisfactory to all the parties hereto."
 "3. Contractor agrees with Agent that he will construct the motel in accordance with the plans and specifications furnished, etc."
 "4. Contractor agrees that he will comply with all state and county laws, codes and regulations governing the construction of this type of building."
 "5. It is mutually agreed by all parties hereto that Harry Dayton shall represent Principal and Agent in facilitating construction of the motel in accordance with all agreements, specifications, plans and blue prints pertaining thereto."
 This portion of the agreement is signed as follows:
 "William H. Mori,"
 Ellen M. Mori,
 Henry L. Hurlburt,
 A. P. Russello, Jr.,
 Harry F. Dayton.""
 Then follows a provision stating that "$52,000 for building will be deposited in Yolo County Title Insurance Company," signed:
 "A. P. Russello, Jr.,"
 H. L. Hurlburt.""
 Then follows a lengthly provision of changes and additions to the specifications, mutually agreed to by all the parties and signed as follows:
 "William H. Mori,"
 Ellen M. Mori,
 Henry L. Hurlburt,
 Al Russello.""
 The gist of the appellants' argument is that as Hurlburt contracted within his authority as agent for a disclosed principal, and did not violate any of the provisions of Civil Code, section 2343, he incurred no personal liabilities under the agreement. Appellants rely on Zumwalt v. Schwarz, 112 Cal.App. 734 [297 P. 608] and Heringer v. Schumacher, 88 Cal.App. 349 [263 P. 550]; the former did not involve a *833 motion for a change of venue, but merely states the general rule that when an agent contracts on behalf of a disclosed principal he incurs no personal liability in the absence of an agreement to the contrary; the latter case is readily distinguishable as the agent signed as follows:
 "For account of Richard J. Murphy,"
 Buyer
 By A. C. Schumacher
 Agent as Authorized.""
 and assumed no duties and obtained no rights under the agreement. The court also pointed out that the true test is whether when all the facts are considered, the contract is that of only the principal or of the principal and the agent. In Hobson v. Hassett, 76 Cal. 203 [18 P. 320, 9 Am.St.Rep. 193], a case involving an undisclosed principal, also relied upon by the appellants, the court stated that the proper test to be applied was the true intent of the parties as revealed in the light of the whole transaction.
 Appellants also rely on the language in the instrument labeling Hurlburt as "Agent." [7] Although a party to a contract is designated therein as an agent of other defendants, his joinder is proper where he is alleged to have entered the agreement on his own behalf. (Zimmer Construction Co. v. White, 8 Cal.App.2d 672 [47 P.2d 1087].) The complaint here alleges in good faith that Hurlburt entered the contract in his own behalf. He clearly obtained rights and assumed duties, as the agreement of June 30, 1955, called for an assignment to him of the note and deed of trust and the interest obligation, as well as the down payment; the agreement of September 7, 1955, with Dayton provided that Dayton would represent "principal and agent" in construction; that Hurlburt would deposit $52,000 with the Yolo Title Insurance Company; and that the respondent agreed with Hurlburt to construct the motel in accordance with the plans and specifications. [8] This would appear to be a case where there is an issue as to the existence of an agency, and in such a case both the alleged agent and principal may be joined for the purpose of determining their relationship and liability. (Klinger v. Modesto Fruit Co., 107 Cal.App. 97 [290 P. 127].)
 In view of the foregoing, there was no error in the trial court's order denying defendants' motion for change of venue. It should be noted also that the motion was made on the *834 additional ground of the convenience of witnesses, at a time when the moving parties had appeared only by demurrer. [9] A motion for a change of venue on the above ground cannot be entertained when the moving party has appeared only by demurrer and not by answer, as the court cannot determine the relevance and materiality of the prospective witnesses. (De Long v. De Long, 127 Cal.App.2d 373 [273 P.2d 921].)
 No prejudicial error appearing in the record before us the order must be affirmed.
 Order affirmed.
 Dooling, J., and Draper, J., concurred.
