fix infinite loop when library is not found