Fix undefined global errors.