Connection logic fixes