Fix bugs in save_result.py