Fixes issue with server shutdown.