   LOCK TABLE provenance_circuit_extra;
   SELECT 1 FROM provenance_circuit_extra WHERE gate = project_token INTO rec;
   IF rec IS NULL THEN
-    PERFORM create_gate(project_token, 'project', ARRAY[token]);
+    PERFORM create_gate(project_token, 'project', ARRAY[token::uuid]);
     INSERT INTO provenance_circuit_extra 
       SELECT gate, case when info=0 then null else info end, row_number() over()
       FROM (

    monus_token:=token1;
  ELSE  
    monus_token:=uuid_generate_v5(uuid_ns_provsql(),concat('monus',token1,token2));
    PERFORM create_gate(monus_token, 'monus', ARRAY[token1, token2]);
  END IF;  

  RETURN monus_token;

CREATE OR REPLACE FUNCTION create_gate(
  token provenance_token,
  type provenance_gate,
  children uuid[] DEFAULT NULL)
  RETURNS void AS
  'provsql','create_gate' LANGUAGE C;
CREATE OR REPLACE FUNCTION get_gate_type(
