Bug fix in Socket Shutdown code