Deduplicate connections, fixes #3