fix possible use of uninitialized value
properly install signal handler