fix "TypeError: Object #<Object> has no method 'global'"