Socket error fix for client