fix bugs. make different libraries for preload and normal use