added server shutdown cleanup code