Fix connection error when multiple clients are connected #330