fix global function