Improve socket connection