socket class implementation fixed