update connect function