Fix global function def bug