Refactor how libraries are checked for connect() function, follow-up.