fixed Lib/ path search

This makes it work on Ubuntu 12.04
Moved looking for path in another function