change newSocket function