add trap_exit for recover