Bugfix: don't share local version of connect function. There might be a cleaner way of doing this