modify trap TERM
clean code