re-add internal lib
fix memory leak