diff --git a/src/Gargantext/Database/Flow.hs b/src/Gargantext/Database/Flow.hs
index c51caf048e7b31b0a1c9a026e54e51dedffd08a4..92dbf2dfc22089392033518eddb976db5ac5d5e4 100644
--- a/src/Gargantext/Database/Flow.hs
+++ b/src/Gargantext/Database/Flow.hs
@@ -308,7 +308,7 @@ ngrams2list = zip (repeat GraphList) . map (\(NgramsT ngt ng) -> (ngt, ng)) . DM
 
 -- | TODO: weight of the list could be a probability
 insertLists :: HasNodeError err => ListId -> [(ListType, (NgramsType, NgramsIndexed))] -> Cmd err Int
-insertLists lId lngs = insertNodeNgrams [ NodeNgram lId (_ngramsId ng) (fromIntegral $ ngramsTypeId ngt) (fromIntegral $ listTypeId l) 1
+insertLists lId lngs = insertNodeNgrams [ NodeNgram lId (_ngramsId ng) (ngramsTypeId ngt) (fromIntegral $ listTypeId l) 1
                      | (l,(ngt, ng)) <- lngs
                    ]
 ------------------------------------------------------------------------
diff --git a/src/Gargantext/Database/Schema/Ngrams.hs b/src/Gargantext/Database/Schema/Ngrams.hs
index 2b3f83f63b33ee5e962625bb6af64a289b14de4b..a110f864a93afc5a312710783d69cc19fe4c2701 100644
--- a/src/Gargantext/Database/Schema/Ngrams.hs
+++ b/src/Gargantext/Database/Schema/Ngrams.hs
@@ -114,10 +114,12 @@ instance FromField NgramsTypeId where
     if (n :: Int) > 0 then return $ NgramsTypeId n
                       else mzero
 
+pgNgramsType :: NgramsType -> Column PGInt4
+pgNgramsType = pgNgramsTypeId . ngramsTypeId
+
 pgNgramsTypeId :: NgramsTypeId -> Column PGInt4
 pgNgramsTypeId (NgramsTypeId n) = pgInt4 n
 
-
 ngramsTypeId :: NgramsType -> NgramsTypeId
 ngramsTypeId Authors     = 1
 ngramsTypeId Institutes  = 2
diff --git a/src/Gargantext/Database/Schema/NodeNgram.hs b/src/Gargantext/Database/Schema/NodeNgram.hs
index ce441e1e69c572ea5f74f24f31e938c32c1f6563..901333734f076360da43ea3ce415a2cb2c900fd5 100644
--- a/src/Gargantext/Database/Schema/NodeNgram.hs
+++ b/src/Gargantext/Database/Schema/NodeNgram.hs
@@ -127,7 +127,7 @@ updateNodeNgrams' :: [(ListId, NgramsTypeId, NgramsText, ListTypeId)] -> Cmd err
 updateNodeNgrams' [] = pure ()
 updateNodeNgrams' input = void $ execPGSQuery updateQuery (PGS.Only $ Values fields input)
   where
-    fields = map (\t-> QualifiedIdentifier Nothing t) ["int4","text","int4"]
+    fields = map (\t-> QualifiedIdentifier Nothing t) ["int4","int4","text","int4"]
 
 updateNodeNgrams'' :: [(ListId, NgramsTypeId, NgramsText, ListTypeId)] -> Cmd err ByteString
 updateNodeNgrams'' input = formatPGSQuery updateQuery (PGS.Only $ Values fields input)
diff --git a/src/Gargantext/Database/TextSearch.hs b/src/Gargantext/Database/TextSearch.hs
index a30d34b429c1c92ebee330254b9f00f3e6426f1f..59426c3ec94b815f826a5e6e1f6a589b23539d86 100644
--- a/src/Gargantext/Database/TextSearch.hs
+++ b/src/Gargantext/Database/TextSearch.hs
@@ -104,7 +104,7 @@ queryInCorpusWithContacts cId q _ _ _ = proc () -> do
   restrict -< (_ns_search docs)              @@ (pgTSQuery  $ unpack q  )
   restrict -< (_ns_typename docs)           .== (pgInt4 $ nodeTypeId NodeDocument)
   restrict -< (nodeNode_node1_id corpusDoc) .== (toNullable $ pgNodeId cId)
-  restrict -< (_nn_listType docNgrams)    .== (toNullable $ pgInt4 $ ngramsTypeId Authors)
+  restrict -< (_nn_listType docNgrams)      .== (toNullable $ pgNgramsType Authors)
   restrict -< (_node_typename contacts)     .== (toNullable $ pgInt4 $ nodeTypeId NodeContact)
   -- let contact_id    = ifThenElse (isNull $ _node_id contacts) (toNullable $ pgInt4 0) (_node_id contacts)
   returnA  -< FacetPaired (_ns_id docs) (_ns_date docs) (_ns_hyperdata docs) (pgInt4 0) (Pair (_node_id contacts) (ngrams_terms ngrams'))