Fix key events on Mac OS X