make the libpath resolving more generic