fixed a bug in the signal handler and a typo