implemented sighandler()