changed socket check