Fix bug where connection wasn't be assigned