fix some bugs from replacing global calls with statics