Simplify code in connect()

This must have been some old copy-paste I never removed.