Fix issue with loadLibrary

It wasn't keeping the library ID around properly