Refactor how libraries are checked for connect() function, and check for connect() as it is done for other functions.