add signal support and solve a valgrind error