Fix detection of socket