fix error with undefined global