Fixed problems with external library detection