fix for server hanging at shutdown