$socket can me undefined - please initialize $socket around line 66 - thx