             [status-im.protocol.ack :as ack]
             [status-im.protocol.web3.utils :as u]
             [status-im.protocol.encryption :as e]
-            [taoensso.timbre :refer-macros [debug]]
+            [taoensso.timbre :as log]
             [status-im.utils.hex :as i]))
 
+(defn create-error [description]
+  (log/debug :parse-payload-error description)
+  {:error description})
+
 (defn- parse-payload [payload]
-  (debug :parse-payload)
+  (log/debug :parse-payload)
   (try
     ;; todo figure why we have to call to-utf8 twice
-    (let [read (comp r/read-string u/to-utf8 u/to-utf8)]
-      {:payload (read payload)})
+    (let [payload'   (u/to-utf8 payload)
+          payload''  (r/read-string payload')
+          payload''' (if (map? payload'')
+                       payload''
+                       (r/read-string (u/to-utf8 payload')))]
+      (if (map? payload''')
+        {:payload payload'''}
+        (create-error (str "Invalid payload type " (type payload''')))))
     (catch :default err
-      (debug :parse-payload-error err)
-      {:error err})))
+      (create-error err))))
 
 (defn- decrypt [key content]
   (try
     {:content (r/read-string (e/decrypt key content))}
     (catch :default err
-      (debug :decrypt-error err)
+      (log/debug :decrypt-error err)
       {:error err})))
 
 (defn- parse-content [key {:keys [content]} was-encrypted?]
-  (debug :parse-content
+  (log/debug :parse-content
          "Key exists:" (not (nil? key))
          "Content exists:" (not (nil? content)))
   (if (and (not was-encrypted?) key content)

  (fn [error js-message]
    ;; todo handle error
    (when error
      (debug :listener-error error))
    (when-not error
      (debug :message-received (js->clj js-message))
      (let [{:keys [sig payload recipientPublicKey] :as message}
            (js->clj js-message :keywordize-keys true)


                                                            (not= "" recipientPublicKey)
                                                            (not (nil? recipientPublicKey))))]
            (if error
              (log/debug :failed-to-handle-message error)
              (let [payload'' (assoc payload' :content content)
                    message'  (assoc message :payload payload''
                                             :to recipientPublicKey
