Fix library loading issue in new sessions