Fix control flow when checking for functions in libs

Addresses part of #52