add some base functions in lib.js