Fix server shutdown