Fix bugs in save_result