Some socket improvements