Improve signal handling in the server