diff --git a/ws.py b/ws.py
index 86f206a20858d4b47bcf00fe8bd14a9cc2301665..b429ee81b64f7ed9bf94e52748ab4094b53e6f7b 100755
--- a/ws.py
+++ b/ws.py
@@ -5,7 +5,8 @@
 
 import json, time
 from websocket import create_connection
-import signal, sys, pickle
+import sys, pickle
+from signal import *
 
 # [(Snapshot_Time, [(buy_price1, amount1), ...] , [(sell_price1, amount1), ...]), ...]
 # [(1620457034392, [(56000, 0.01), (55900, 1), (55700, 30), ...] , [(57000, 0.01), (57100, 1), ...] ), (1620457034394, [...]), ...]
@@ -74,8 +75,9 @@ def dataset_maintain_thread_main():
             print("ERROR: unexpected message (maybe ping message): ", message)
 
         ###### DEBUG ONLY
-        # if int(time.time()) % 60 == 0 and _debug_tmp != int(time.time()):
-        #     _debug_tmp = int(time.time())
+        if int(time.time()) % 2000 == 0 and _debug_tmp != int(time.time()): # 2000 sec
+            _debug_tmp = int(time.time())
+            print("DEBUG: len(depth) = ", len(realtime_shortterm_dataset_depth))
         #     print("DEBUG: dumping realtime_shortterm_dataset_aggtrade================")
         #     print(realtime_shortterm_dataset_aggtrade)
         #     print("DEBUG: dumping realtime_shortterm_dataset_depth================")
@@ -89,7 +91,14 @@ def sigint_handler(sig, frame):
     save_realtime_dataset_on_exit()
     sys.exit(0)
 
-signal.signal(signal.SIGINT, sigint_handler)
+for sig in (SIGABRT, SIGILL, SIGINT, SIGSEGV, SIGTERM):
+    signal(sig, sigint_handler)
+
 load_realtime_dataset_on_start()
-dataset_maintain_thread_main()
+try:
+    dataset_maintain_thread_main()
+except:
+    save_realtime_dataset_on_exit()
+    raise
+