Fix `define_method` error

For some reason, the previous code was throwing this error all over:

```
undefined method `define_method' for main:Object
```

Now it doesn’t anymore.