Fixed async state bugs for the library loader.