Fix event handlers on ruby 2

Fixes #4219
Land #4375