Fixed crash when connecting with only one available port