Avoid twice connect() in source code (closes #194)