diff --git a/tinman/txgen.py b/tinman/txgen.py
index 860c96d106decc54c240e3be7d39460dc7c0a073..0facf5899c2af45960cb761c24290ff715b484c5 100755
--- a/tinman/txgen.py
+++ b/tinman/txgen.py
@@ -425,7 +425,9 @@ def build_actions(conf, silent=True):
         print("WARNING: Older snapshot encountered.", file=sys.stderr)
     
     if backfill_file and os.path.exists(backfill_file) and os.path.isfile(backfill_file):
-        num_lines = sum(1 for line in open(backfill_file))
+        with open(backfill_file, "r") as f:
+            num_lines = sum(1 for line in f)
+        
         if num_lines > 0:
             metadata["backfill_actions:count"] = num_lines
             metadata["actions:count"] += num_lines
@@ -439,9 +441,9 @@ def build_actions(conf, silent=True):
             yield ["submit_transaction", {"tx" : tx}]
     
     if has_backfill:
-        with open(conf["backfill_file"], "rb") as f:
-            for line in input_file:
-                yield line
+        with open(backfill_file, "r") as f:
+            for line in f:
+                yield json.loads(line)
     
     for tx in update_witnesses(conf, keydb, "init"):
         yield ["submit_transaction", {"tx" : tx}]
diff --git a/tinman/util.py b/tinman/util.py
index 24850a1378539ba3eb60e059bde8182240dcf1d3..605a832c5455382251d0965c06f9cf689431b42e 100644
--- a/tinman/util.py
+++ b/tinman/util.py
@@ -130,6 +130,9 @@ def action_to_str(action):
     This serializes actions, picking a string that does not occur in the JSON
     serialization to escape public/private key notes.
     """
+    if "esc" in action:
+        return json.dumps(action, separators=(",", ":"), sort_keys=True)
+    
     json_empty_esc = json.dumps(action, separators=(",", ":"), default=prockey.PubkeySerializer(esc=""), sort_keys=True)
     esc = find_non_substr(json_empty_esc, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
     action[1]["esc"] = esc