bag fix load-library functions