added freeLibrary (didn't test)