Fix library detection