Revert "Revert "fixed loading of libs""

This reverts commit d73dada672e18808d294958b89b93001fff826cd.