--- a/ocaml/xapi/xapi.ml
+++ b/ocaml/xapi/xapi.ml
@@ -39,7 +39,7 @@
   let uuid = Xapi_inventory.lookup Xapi_inventory._control_domain_uuid in
   if domuuid <> uuid then (
     info "dom0 uuid mismatch with inventory -- setting it the proper value";
-    with_xc (fun xc -> Xc.domain_sethandle xc 0 uuid)
+    with_xc (fun xc -> Xc.domain_sethandle xc 0 (Uuid.uuid_of_string uuid))
   )
 
 (** Perform some startup sanity checks. Note that we nolonger look for processes using 'ps':
--- a/ocaml/xenops/domain.ml
+++ b/ocaml/xenops/domain.ml
@@ -115,7 +115,7 @@
            ) else
               default_flags
         ) else [] in
-	let domid = Xc.domain_create xc info.ssidref flags (Uuid.to_string uuid) in
+	let domid = Xc.domain_create xc info.ssidref flags uuid in
 	let name = if info.name <> "" then info.name else sprintf "Domain-%d" domid in
 	try
 		let dom_path = xs.Xs.getdomainpath domid in
@@ -386,7 +386,7 @@
 	  (* CA-13801: to avoid confusing people, we shall change this domain's uuid *)
 	  let s = Printf.sprintf "deadbeef-dead-beef-dead-beef0000%04x" domid in
 	  warn "Domain stuck in dying state after 30s; resetting UUID to %s" s;
-	  Xc.domain_sethandle xc domid s;
+	  Xc.domain_sethandle xc domid (Uuid.uuid_of_string s);
 	  raise (Domain_stuck_in_dying_state domid)
 	end
 
