allow Libs.moment and Libs.chance to be used in before functions

this is to prepare the usage of user defined libs.