Is that last event on line 23 where variables are cleaned up meant to be on *:sockclose: instead of sockread?
on *:sockclose: