Fix event handling issues in IE

Fixes #232, #234