lib instantiation change, bugfixes