Changes to make it work in v8