Fix #61 in osx

In OSX it seems that e.target can be something different than previously expected.