fix stack overflow bug when sighandler was called
small changes