refactor(connections): fix a few weird bugs and tests